00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #ifndef __soap_logging_h
00026 #define __soap_logging_h
00027
00039 #define CSOAP_ARG_LOGFILE "-CSOAPlog"
00040 #define CSOAP_ARG_LOGLEVEL "-CSOAPloglevel"
00041
00044 typedef enum soap_loglevel
00045 {
00046 SOAP_LOG_OFF,
00048 SOAP_LOG_VERBOSE,
00050 SOAP_LOG_DEBUG,
00052 SOAP_LOG_INFO,
00053 SOAP_LOG_WARN,
00054 SOAP_LOG_ERROR,
00057 SOAP_LOG_FATAL
00058 } soap_loglevel_t;
00059
00060 #define SOAP_LOG_LEVEL_OFF_STRING "OFF"
00061 #define SOAP_LOG_LEVEL_VERBOSE_STRING "VERBOSE"
00062 #define SOAP_LOG_LEVEL_DEBUG_STRING "DEBUG"
00063 #define SOAP_LOG_LEVEL_INFO_STRING "INFO"
00064 #define SOAP_LOG_LEVEL_WARN_STRING "WARN"
00065 #define SOAP_LOG_LEVEL_ERROR_STRING "ERROR"
00066 #define SOAP_LOG_LEVEL_FATAL_STRING "FATAL"
00067 #define SOAP_LOG_LEVEL_UNKNOWN_STRING "UNKNWON"
00068
00069 #ifdef __cplusplus
00070 extern "C" {
00071 #endif
00072
00079 extern soap_loglevel_t soap_set_loglevel(soap_loglevel_t loglevel);
00080
00085 extern soap_loglevel_t soap_get_loglevel(void);
00086
00091 extern void soap_set_logfile(const char *filename);
00092
00097 extern char *soap_get_logfile(void);
00098
00099 #define SOAP_LOG_DISABLED 0x00
00100 #define SOAP_LOG_FOREGROUND 0x01
00101 #define SOAP_LOG_SYSLOG 0x02
00111 extern int soap_log_set_logtype(int type);
00112
00113 #ifdef WIN32
00114 #if defined(_MSC_VER) && _MSC_VER <= 1200
00115 extern char *VisualC_funcname(const char *file, int line);
00116 #define __FUNCTION__ VisualC_funcname(__FILE__, __LINE__)
00117 #endif
00118 #endif
00119
00120 #ifdef __cplusplus
00121 }
00122 #endif
00123
00124 #define log_verbose(fmt, ...) _nanohttp_log_printf(SOAP_LOG_VERBOSE, \
00125 SOAP_LOG_LEVEL_VERBOSE_STRING " %s: " fmt "\n", \
00126 __FUNCTION__, ## __VA_ARGS__)
00127
00128 #define log_debug(fmt, ...) _nanohttp_log_printf(SOAP_LOG_DEBUG, \
00129 SOAP_LOG_LEVEL_DEBUG_STRING " %s: " fmt "\n", \
00130 __FUNCTION__, ## __VA_ARGS__)
00131
00132 #define log_info(fmt, ...) _nanohttp_log_printf(SOAP_LOG_INFO, \
00133 SOAP_LOG_LEVEL_INFO_STRING " %s: " fmt "\n", \
00134 __FUNCTION__, ## __VA_ARGS__)
00135
00136 #define log_warn(fmt, ...) _nanohttp_log_printf(SOAP_LOG_WARN, \
00137 SOAP_LOG_LEVEL_WARN_STRING " %s: " fmt "\n", \
00138 __FUNCTION__, ## __VA_ARGS__)
00139
00140 #define log_error(fmt, ...) _nanohttp_log_printf(SOAP_LOG_ERROR, \
00141 SOAP_LOG_LEVEL_ERROR_STRING " %s: " fmt "\n", \
00142 __FUNCTION__, ## __VA_ARGS__)
00143
00144 #define log_fatal(fmt, ...) _nanohttp_log_printf(SOAP_LOG_FATAL, \
00145 SOAP_LOG_LEVEL_FATAL_STRING " %s: " fmt "\n", \
00146 __FUNCTION__, ## __VA_ARGS__)
00147
00150 #endif