axis2_log.h

00001 /*
00002  * Copyright 2004,2005 The Apache Software Foundation.
00003  *
00004  * Licensed under the Apache License, Version 2.0 (the "License");
00005  * you may not use this file except in compliance with the License.
00006  * You may obtain a copy of the License at
00007  *
00008  *      http://www.apache.org/licenses/LICENSE-2.0
00009  *
00010  * Unless required by applicable law or agreed to in writing, software
00011  * distributed under the License is distributed on an "AS IS" BASIS,
00012  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00013  * See the License for the specific language governing permissions and
00014  * limitations under the License.
00015  */
00016 
00017 #ifndef AXIS2_LOG_H
00018 #define AXIS2_LOG_H
00019 
00020 #include <axis2_allocator.h>
00021 
00022 #ifdef __cplusplus
00023 extern "C"
00024 {
00025 #endif
00026 
00027     typedef struct axis2_log_ops axis2_log_ops_t;
00028    typedef struct axis2_log axis2_log_t;
00029 
00030 
00031 #define AXIS2_LOG_SI __FILE__,__LINE__
00032 
00039 /*TODO:log_xml*/
00040 
00056     typedef enum axis2_log_levels
00057     {
00059         AXIS2_LOG_LEVEL_CRITICAL = 0,
00061         AXIS2_LOG_LEVEL_ERROR,
00063         AXIS2_LOG_LEVEL_WARNING,
00065         AXIS2_LOG_LEVEL_INFO,
00067         AXIS2_LOG_LEVEL_DEBUG,
00069         AXIS2_LOG_LEVEL_TRACE
00070     } axis2_log_levels_t;
00071 
00072 
00073 
00074 
00075 
00076 
00077 
00083     struct axis2_log_ops
00084     {
00085     
00091        axis2_status_t (AXIS2_CALL *
00092       free) (axis2_allocator_t *allocator, 
00093             struct axis2_log *log);
00094 
00101         axis2_status_t (AXIS2_CALL *
00102        write) (axis2_log_t *log, 
00103              const axis2_char_t *buffer, 
00104              axis2_log_levels_t level,
00105              const axis2_char_t *file,
00106              const int line);
00107     };
00108 
00114     struct axis2_log
00115     {
00117         struct axis2_log_ops *ops;
00119         axis2_log_levels_t level;
00121         axis2_bool_t enabled;
00122 
00123     };
00124 
00125 AXIS2_EXTERN axis2_status_t AXIS2_CALL 
00126 axis2_log_impl_log_critical(axis2_log_t *log, 
00127                       const axis2_char_t *filename, 
00128                      const int linenumber,
00129                      const axis2_char_t *format,...);
00130 
00131 AXIS2_EXTERN axis2_status_t AXIS2_CALL 
00132 axis2_log_impl_log_error(axis2_log_t *log,
00133                    const axis2_char_t *filename,
00134                    const int linenumber,
00135                    const axis2_char_t *format,...);
00136 
00137 AXIS2_EXTERN axis2_status_t AXIS2_CALL 
00138 axis2_log_impl_log_warning(axis2_log_t *log,
00139                      const axis2_char_t *filename,
00140                           const int linenumber,
00141                           const axis2_char_t *format,...);
00142 
00143 AXIS2_EXTERN axis2_status_t AXIS2_CALL 
00144 axis2_log_impl_log_info(axis2_log_t *log, 
00145                   const axis2_char_t *format,...);
00146 
00147 AXIS2_EXTERN axis2_status_t AXIS2_CALL 
00148 axis2_log_impl_log_debug(axis2_log_t *log,
00149                    const axis2_char_t *filename,
00150                    const int linenumber,
00151                    const axis2_char_t *format,...);
00152 
00153 AXIS2_EXTERN axis2_status_t AXIS2_CALL 
00154 axis2_log_impl_log_trace(axis2_log_t *log,
00155                          const axis2_char_t *filename,
00156                    const int linenumber,
00157                    const axis2_char_t *format,...);
00158 
00159 #define AXIS2_LOG_FREE(allocator, log) \
00160       ((log->ops)->free(allocator, log))
00161 
00162 #define AXIS2_LOG_WRITE(log, buffer, level) \
00163       ((log)->ops->write(log, buffer, level,AXIS2_LOG_SI))
00164 
00165 #define AXIS2_LOG_DEBUG axis2_log_impl_log_debug 
00166 #define AXIS2_LOG_INFO axis2_log_impl_log_info 
00167 #define AXIS2_LOG_WARNING axis2_log_impl_log_warning 
00168 #define AXIS2_LOG_ERROR axis2_log_impl_log_error 
00169 #define AXIS2_LOG_CRITICAL axis2_log_impl_log_critical 
00170 
00171 #ifdef AXIS2_TRACE
00172 #define AXIS2_LOG_TRACE axis2_log_impl_log_trace
00173 #else
00174   #ifdef WIN32
00175   #define AXIS2_LOG_TRACE axis2_log_impl_log_trace
00176   #else
00177   #define AXIS2_LOG_TRACE(params, args ...)
00178   #endif
00179 #endif
00180 
00183 #ifdef __cplusplus
00184 }
00185 #endif
00186 
00187 #endif                          /* AXIS2_LOG_H */

Generated on Tue Oct 3 18:21:10 2006 for Axis2/C by  doxygen 1.4.7