00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef AXIS2_LOG_H
00019 #define AXIS2_LOG_H
00020
00021 #include <axis2_allocator.h>
00022
00023 #ifdef __cplusplus
00024 extern "C"
00025 {
00026 #endif
00027
00028 typedef struct axis2_log_ops axis2_log_ops_t;
00029 typedef struct axis2_log axis2_log_t;
00030
00031
00032 #define AXIS2_LOG_SI __FILE__,__LINE__
00033
00040
00041
00057 typedef enum axis2_log_levels
00058 {
00060 AXIS2_LOG_LEVEL_CRITICAL = 0,
00062 AXIS2_LOG_LEVEL_ERROR,
00064 AXIS2_LOG_LEVEL_WARNING,
00066 AXIS2_LOG_LEVEL_INFO,
00068 AXIS2_LOG_LEVEL_DEBUG,
00070 AXIS2_LOG_LEVEL_TRACE
00071 } axis2_log_levels_t;
00072
00073
00074
00075
00076
00077
00078
00084 struct axis2_log_ops
00085 {
00086
00092 void (AXIS2_CALL *
00093 free) (axis2_allocator_t *allocator,
00094 struct axis2_log *log);
00095
00102 void (AXIS2_CALL *
00103 write) (axis2_log_t *log,
00104 const axis2_char_t *buffer,
00105 axis2_log_levels_t level,
00106 const axis2_char_t *file,
00107 const int line);
00108 };
00109
00115 struct axis2_log
00116 {
00118 struct axis2_log_ops *ops;
00120 axis2_log_levels_t level;
00122 axis2_bool_t enabled;
00123
00124 };
00125
00126 AXIS2_EXTERN void AXIS2_CALL
00127 axis2_log_impl_log_critical(axis2_log_t *log,
00128 const axis2_char_t *filename,
00129 const int linenumber,
00130 const axis2_char_t *format,...);
00131
00132 AXIS2_EXTERN void AXIS2_CALL
00133 axis2_log_impl_log_error(axis2_log_t *log,
00134 const axis2_char_t *filename,
00135 const int linenumber,
00136 const axis2_char_t *format,...);
00137
00138 AXIS2_EXTERN void AXIS2_CALL
00139 axis2_log_impl_log_warning(axis2_log_t *log,
00140 const axis2_char_t *filename,
00141 const int linenumber,
00142 const axis2_char_t *format,...);
00143
00144 AXIS2_EXTERN void AXIS2_CALL
00145 axis2_log_impl_log_info(axis2_log_t *log,
00146 const axis2_char_t *format,...);
00147
00148 AXIS2_EXTERN void AXIS2_CALL
00149 axis2_log_impl_log_debug(axis2_log_t *log,
00150 const axis2_char_t *filename,
00151 const int linenumber,
00152 const axis2_char_t *format,...);
00153
00154 AXIS2_EXTERN void AXIS2_CALL
00155 axis2_log_impl_log_trace(axis2_log_t *log,
00156 const axis2_char_t *filename,
00157 const int linenumber,
00158 const axis2_char_t *format,...);
00159
00160 #define AXIS2_LOG_FREE(allocator, log) \
00161 ((log->ops)->free(allocator, log))
00162
00163 #define AXIS2_LOG_WRITE(log, buffer, level) \
00164 ((log)->ops->write(log, buffer, level,AXIS2_LOG_SI))
00165
00166 #define AXIS2_LOG_DEBUG axis2_log_impl_log_debug
00167 #define AXIS2_LOG_INFO axis2_log_impl_log_info
00168 #define AXIS2_LOG_WARNING axis2_log_impl_log_warning
00169 #define AXIS2_LOG_ERROR axis2_log_impl_log_error
00170 #define AXIS2_LOG_CRITICAL axis2_log_impl_log_critical
00171
00172 #ifdef AXIS2_TRACE
00173 #define AXIS2_LOG_TRACE axis2_log_impl_log_trace
00174 #else
00175 # ifdef HAVE_GNUC_VARARGS
00176 # define AXIS2_LOG_TRACE(params, args ...)
00177 # elif defined HAVE_ISO_VARARGS
00178 # define AXIS2_LOG_TRACE(params, ...)
00179 # elif __STDC__ && __STDC_VERSION > 199901L
00180 # define AXIS2_LOG_TRACE(params, ...)
00181 # elif WIN32
00182 # define AXIS2_LOG_TRACE axis2_log_impl_log_trace
00183 # else
00184 # define AXIS2_LOG_TRACE axis2_log_impl_log_trace
00185 # endif
00186 #endif
00187
00190 #ifdef __cplusplus
00191 }
00192 #endif
00193
00194 #endif
00195
00196
00197
00198