2 #include "../acl_cpp_define.hpp" 5 #define logger_open acl::log::open 6 #define logger_close acl::log::close 8 #if defined(_WIN32) || defined(_WIN64) 11 # define logger(fmt, ...) \ 12 acl::log::msg4(__FILE__, __LINE__, __FUNCTION__, fmt, __VA_ARGS__) 13 # define logger_warn(fmt, ...) \ 14 acl::log::warn4(__FILE__, __LINE__, __FUNCTION__, fmt, __VA_ARGS__) 15 # define logger_error(fmt, ...) \ 16 acl::log::error4(__FILE__, __LINE__, __FUNCTION__, fmt, __VA_ARGS__) 17 # define logger_fatal(fmt, ...) \ 18 acl::log::fatal4(__FILE__, __LINE__, __FUNCTION__, fmt, __VA_ARGS__) 19 # define logger_debug(section, level, fmt, ...) \ 20 acl::log::msg6(section, level, __FILE__, __LINE__, __FUNCTION__, fmt, __VA_ARGS__) 22 # define logger acl::log::msg1 23 # define logger_warn acl::log::warn1 24 # define logger_error acl::log::error1 25 # define logger_fatal acl::log::fatal1 26 # define logger_debug acl::log::msg3 31 # ifdef ACL_CPP_LOG_SKIP_FILE 32 # define logger(fmt, args...) \ 33 acl::log::msg4("none", __LINE__, __FUNCTION__, fmt, ##args) 34 # define logger_warn(fmt, args...) \ 35 acl::log::warn4("none", __LINE__, __FUNCTION__, fmt, ##args) 36 # define logger_error(fmt, args...) \ 37 acl::log::error4("none", __LINE__, __FUNCTION__, fmt, ##args) 38 # define logger_fatal(fmt, args...) \ 39 acl::log::fatal4("none", __LINE__, __FUNCTION__, fmt, ##args) 40 # define logger_debug(section, level, fmt, args...) \ 41 acl::log::msg6(section, level, __FUNCTION__, __LINE__, __FUNCTION__, fmt, ##args) 43 # define logger(fmt, args...) \ 44 acl::log::msg4(__FILE__, __LINE__, __FUNCTION__, fmt, ##args) 45 # define logger_warn(fmt, args...) \ 46 acl::log::warn4(__FILE__, __LINE__, __FUNCTION__, fmt, ##args) 47 # define logger_error(fmt, args...) \ 48 acl::log::error4(__FILE__, __LINE__, __FUNCTION__, fmt, ##args) 49 # define logger_fatal(fmt, args...) \ 50 acl::log::fatal4(__FILE__, __LINE__, __FUNCTION__, fmt, ##args) 51 # define logger_debug(section, level, fmt, args...) \ 52 acl::log::msg6(section, level, __FUNCTION__, __LINE__, __FUNCTION__, fmt, ##args) 76 static void open(
const char* recipients,
const char* procname =
"unknown",
77 const char* cfg = NULL);
82 static void close(
void);
90 static void debug_init(
const char* cfg);
97 static void stdout_open(
bool onoff);
105 int line,
const char* func,
const char*
fmt, ...);
107 size_t level, const
char*
fmt, ...);
109 const
char* fname,
int line, const
char* func, const
char*
fmt, ...);
113 const
char* func, const
char*
fmt, ...);
117 const
char* func, const
char*
fmt, ...);
121 const
char* func, const
char*
fmt, ...);
123 static
void vmsg2(const
char*
fmt, va_list ap);
124 static
void vmsg5(const
char* fname,
int line, const
char* func,
125 const
char*
fmt, va_list ap);
126 static
void vmsg4(
size_t section,
size_t level, const
char*
fmt, va_list ap);
127 static
void vmsg7(
size_t section,
size_t level, const
char* fname,
128 int line, const
char* func, const
char*
fmt, va_list ap);
130 static
void vwarn2(const
char*
fmt, va_list ap);
131 static
void vwarn5(const
char* fname,
int line, const
char* func,
132 const
char*
fmt, va_list ap);
134 static
void verror2(const
char*
fmt, va_list ap);
135 static
void verror5(const
char* fname,
int line, const
char* func,
136 const
char*
fmt, va_list ap);
138 static
void vfatal2(const
char*
fmt, va_list ap);
139 static
void vfatal5(const
char* fname,
int line, const
char* func,
140 const
char*
fmt, va_list ap);
145 static
void logger_test1(
void)
147 #define DEBUG_BASE 100 148 #define DEBUG_TEST1 (DEBUG_BASE + 1) 149 #define DEBUG_TEST2 (DEBUG_BASE + 2) 150 #define DEBUG_TEST3 (DEBUG_BASE + 3) 152 const char* logfile =
"test.log", *procname =
"test";
153 const char* cfg =
"101:2; 102:3; 103:2";
158 #if defined(VC2003) || defined(VC2002) || defined(VC6) 162 logger(
"%s(%d), %s: %s", __FILE__, __LINE__, __FUNCTION__,
"zsx");
165 __FILE__, __LINE__, __FUNCTION__,
"zsx");
167 __FILE__, __LINE__, __FUNCTION__,
"zsx");
169 __FILE__, __LINE__, __FUNCTION__,
"zsx");
174 __FILE__, __LINE__, __FUNCTION__,
"zsx");
176 #else // VC2005, VC2008, VC2010 180 logger(
"error(%s)!",
"zsx");
#define logger(fmt, args...)
#define ACL_CPP_PRINTF(format_idx, arg_idx)
#define logger_fatal(fmt, args...)
#define logger_error(fmt, args...)
static void logger_test2(void)
#define logger_debug(section, level, fmt, args...)
ACL_API void const char * fmt
#define logger_warn(fmt, args...)