00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
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
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