00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef AXUTIL_LOG_H
00019 #define AXUTIL_LOG_H
00020
00021 #include <axutil_allocator.h>
00022
00023 #ifdef __cplusplus
00024 extern "C"
00025 {
00026 #endif
00027
00028 typedef struct axutil_log_ops axutil_log_ops_t;
00029 typedef struct axutil_log axutil_log_t;
00030
00031
00032 #define AXIS2_LOG_SI __FILE__,__LINE__
00033
00055 typedef enum axutil_log_levels
00056 {
00058 AXIS2_LOG_LEVEL_CRITICAL = 0,
00060 AXIS2_LOG_LEVEL_ERROR,
00062 AXIS2_LOG_LEVEL_WARNING,
00064 AXIS2_LOG_LEVEL_INFO,
00066 AXIS2_LOG_LEVEL_DEBUG,
00068 AXIS2_LOG_LEVEL_TRACE
00069 } axutil_log_levels_t;
00070
00076 struct axutil_log_ops
00077 {
00078
00084 void(AXIS2_CALL *
00085 free)(axutil_allocator_t *allocator,
00086 struct axutil_log *log);
00087
00094 void(AXIS2_CALL *
00095 write)(axutil_log_t *log,
00096 const axis2_char_t *buffer,
00097 axutil_log_levels_t level,
00098 const axis2_char_t *file,
00099 const int line);
00100 };
00101
00107 struct axutil_log
00108 {
00110 const axutil_log_ops_t *ops;
00112 axutil_log_levels_t level;
00114 axis2_bool_t enabled;
00115
00116 };
00117
00118 AXIS2_EXTERN void AXIS2_CALL
00119 axutil_log_impl_log_critical(axutil_log_t *log,
00120 const axis2_char_t *filename,
00121 const int linenumber,
00122 const axis2_char_t *format, ...);
00123
00124 AXIS2_EXTERN void AXIS2_CALL
00125 axutil_log_impl_log_error(axutil_log_t *log,
00126 const axis2_char_t *filename,
00127 const int linenumber,
00128 const axis2_char_t *format, ...);
00129
00130 AXIS2_EXTERN void AXIS2_CALL
00131 axutil_log_impl_log_warning(axutil_log_t *log,
00132 const axis2_char_t *filename,
00133 const int linenumber,
00134 const axis2_char_t *format, ...);
00135
00136 AXIS2_EXTERN void AXIS2_CALL
00137 axutil_log_impl_log_info(axutil_log_t *log,
00138 const axis2_char_t *format, ...);
00139
00140 AXIS2_EXTERN void AXIS2_CALL
00141 axutil_log_impl_log_debug(axutil_log_t *log,
00142 const axis2_char_t *filename,
00143 const int linenumber,
00144 const axis2_char_t *format, ...);
00145
00146 AXIS2_EXTERN void AXIS2_CALL
00147 axutil_log_impl_log_trace(axutil_log_t *log,
00148 const axis2_char_t *filename,
00149 const int linenumber,
00150 const axis2_char_t *format, ...);
00151
00152 AXIS2_EXTERN void AXIS2_CALL
00153 axutil_log_free(axutil_allocator_t *allocator,
00154 struct axutil_log *log);
00155
00156 AXIS2_EXTERN void AXIS2_CALL
00157 axutil_log_write(axutil_log_t *log,
00158 const axis2_char_t *buffer,
00159 axutil_log_levels_t level,
00160 const axis2_char_t *file,
00161 const int line);
00162
00163 #define AXIS2_LOG_FREE(allocator, log) \
00164 axutil_log_free(allocator, log)
00165
00166 #define AXIS2_LOG_WRITE(log, buffer, level, file) \
00167 axutil_log_write(log, buffer, level, file, AXIS2_LOG_SI)
00168
00169 #define AXIS2_LOG_DEBUG axutil_log_impl_log_debug
00170 #define AXIS2_LOG_INFO axutil_log_impl_log_info
00171 #define AXIS2_LOG_WARNING axutil_log_impl_log_warning
00172 #define AXIS2_LOG_ERROR axutil_log_impl_log_error
00173 #define AXIS2_LOG_CRITICAL axutil_log_impl_log_critical
00174
00175 #ifdef AXIS2_TRACE
00176 #define AXIS2_LOG_TRACE axutil_log_impl_log_trace
00177 #else
00178 # ifdef HAVE_GNUC_VARARGS
00179 # define AXIS2_LOG_TRACE(params, args ...)
00180 # elif defined HAVE_ISO_VARARGS
00181 # define AXIS2_LOG_TRACE(params, ...)
00182 # elif __STDC__ && __STDC_VERSION > 199901L
00183 # define AXIS2_LOG_TRACE(params, ...)
00184 # elif WIN32
00185 # define AXIS2_LOG_TRACE axutil_log_impl_log_trace
00186 # else
00187 # define AXIS2_LOG_TRACE axutil_log_impl_log_trace
00188 # endif
00189 #endif
00190
00193 #ifdef __cplusplus
00194 }
00195 #endif
00196
00197 #endif
00198
00199
00200
00201