acl  3.5.3.0
acl::log类 参考

#include <log.hpp>

+ acl::log 的协作图:

静态 Public 成员函数

static void open (const char *recipients, const char *procname="unknown", const char *cfg=NULL)
 
static void close (void)
 
static void debug_init (const char *cfg)
 
static void stdout_open (bool onoff)
 
static void ACL_CPP_PRINTF (1, 2) msg1(const char *fmt
 
static void static void ACL_CPP_PRINTF (4, 5) msg4(const char *fname
 
static void static void int const char const char static void ACL_CPP_PRINTF (3, 4) msg3(size_t section
 
static void static void int const char const char static void size_t const char static void ACL_CPP_PRINTF (6, 7) msg6(size_t section
 
static void static void int const char const char static void size_t const char static void size_t const char int const char const char static void ACL_CPP_PRINTF (1, 2) warn1(const char *fmt
 
static void static void int const char const char static void size_t const char static void size_t const char int const char const char static void static void ACL_CPP_PRINTF (4, 5) warn4(const char *fname
 
static void static void int const char const char static void size_t const char static void size_t const char int const char const char static void static void int const char const char static void ACL_CPP_PRINTF (1, 2) error1(const char *fmt
 
static void static void int const char const char static void size_t const char static void size_t const char int const char const char static void static void int const char const char static void static void ACL_CPP_PRINTF (4, 5) error4(const char *fname
 
static void static void int const char const char static void size_t const char static void size_t const char int const char const char static void static void int const char const char static void static void int const char const char static void ACL_CPP_PRINTF (1, 2) fatal1(const char *fmt
 
static void static void int const char const char static void size_t const char static void size_t const char int const char const char static void static void int const char const char static void static void int const char const char static void static void ACL_CPP_PRINTF (4, 5) fatal4(const char *fname
 
static void static void int const char const char static void size_t const char static void size_t const char int const char const char static void static void int const char const char static void static void int const char const char static void static void int const char const char static void vmsg2 (const char *fmt, va_list ap)
 
static void vmsg5 (const char *fname, int line, const char *func, const char *fmt, va_list ap)
 
static void vmsg4 (size_t section, size_t level, const char *fmt, va_list ap)
 
static void vmsg7 (size_t section, size_t level, const char *fname, int line, const char *func, const char *fmt, va_list ap)
 
static void vwarn2 (const char *fmt, va_list ap)
 
static void vwarn5 (const char *fname, int line, const char *func, const char *fmt, va_list ap)
 
static void verror2 (const char *fmt, va_list ap)
 
static void verror5 (const char *fname, int line, const char *func, const char *fmt, va_list ap)
 
static void vfatal2 (const char *fmt, va_list ap)
 
static void vfatal5 (const char *fname, int line, const char *func, const char *fmt, va_list ap)
 
static void logger_test1 (void)
 
static void logger_test2 (void)
 

Public 属性

static void static void int line
 
static void static void int const char * func
 
static void static void int const char const char * fmt
 
static void static void int const char const char static void size_t level
 
static void static void int const char const char static void size_t const char * fmt
 
static void static void int const char const char static void size_t const char static void size_t level
 
static void static void int const char const char static void size_t const char static void size_t const char * fname
 
static void static void int const char const char static void size_t const char static void size_t const char int line
 
static void static void int const char const char static void size_t const char static void size_t const char int const char * func
 
static void static void int const char const char static void size_t const char static void size_t const char int const char const char * fmt
 
static void static void int const char const char static void size_t const char static void size_t const char int const char const char static void static void int line
 
static void static void int const char const char static void size_t const char static void size_t const char int const char const char static void static void int const char * func
 
static void static void int const char const char static void size_t const char static void size_t const char int const char const char static void static void int const char const char * fmt
 
static void static void int const char const char static void size_t const char static void size_t const char int const char const char static void static void int const char const char static void static void int line
 
static void static void int const char const char static void size_t const char static void size_t const char int const char const char static void static void int const char const char static void static void int const char * func
 
static void static void int const char const char static void size_t const char static void size_t const char int const char const char static void static void int const char const char static void static void int const char const char * fmt
 
static void static void int const char const char static void size_t const char static void size_t const char int const char const char static void static void int const char const char static void static void int const char const char static void static void int line
 
static void static void int const char const char static void size_t const char static void size_t const char int const char const char static void static void int const char const char static void static void int const char const char static void static void int const char * func
 
static void static void int const char const char static void size_t const char static void size_t const char int const char const char static void static void int const char const char static void static void int const char const char static void static void int const char const char * fmt
 

详细描述

在文件 log.hpp61 行定义.

成员函数说明

◆ ACL_CPP_PRINTF() [1/10]

static void acl::log::ACL_CPP_PRINTF ( ,
 
) const
static

日志记录函数

◆ ACL_CPP_PRINTF() [2/10]

static void static void acl::log::ACL_CPP_PRINTF ( ,
 
) const
static

◆ ACL_CPP_PRINTF() [3/10]

static void static void int const char const char static void acl::log::ACL_CPP_PRINTF ( ,
 
)
static

◆ ACL_CPP_PRINTF() [4/10]

static void static void int const char const char static void size_t const char static void acl::log::ACL_CPP_PRINTF ( ,
 
)
static

◆ ACL_CPP_PRINTF() [5/10]

static void static void int const char const char static void size_t const char static void size_t const char int const char const char static void acl::log::ACL_CPP_PRINTF ( ,
 
) const
static

◆ ACL_CPP_PRINTF() [6/10]

static void static void int const char const char static void size_t const char static void size_t const char int const char const char static void static void acl::log::ACL_CPP_PRINTF ( ,
 
) const
static

◆ ACL_CPP_PRINTF() [7/10]

static void static void int const char const char static void size_t const char static void size_t const char int const char const char static void static void int const char const char static void acl::log::ACL_CPP_PRINTF ( ,
 
) const
static

◆ ACL_CPP_PRINTF() [8/10]

static void static void int const char const char static void size_t const char static void size_t const char int const char const char static void static void int const char const char static void static void acl::log::ACL_CPP_PRINTF ( ,
 
) const
static

◆ ACL_CPP_PRINTF() [9/10]

static void static void int const char const char static void size_t const char static void size_t const char int const char const char static void static void int const char const char static void static void int const char const char static void acl::log::ACL_CPP_PRINTF ( ,
 
) const
static

◆ ACL_CPP_PRINTF() [10/10]

static void static void int const char const char static void size_t const char static void size_t const char int const char const char static void static void int const char const char static void static void int const char const char static void static void acl::log::ACL_CPP_PRINTF ( ,
 
) const
static

◆ close()

static void acl::log::close ( void  )
static

程序退出前调用此函数关闭日志

◆ debug_init()

static void acl::log::debug_init ( const char *  cfg)
static

初始化日志调试调用接口

参数
cfg{const char*} 调试标签及级别字符串, 格式如下: {section}:{level}; {section}:{level}; ... 如: 1:1, 2:10, 3:8... or 1:1; 2:10; 3:8... or all:1

◆ logger_test1()

static void acl::log::logger_test1 ( void  )
inlinestatic

在文件 log.hpp145 行定义.

146  {
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)
151 
152  const char* logfile = "test.log", *procname = "test";
153  const char* cfg = "101:2; 102:3; 103:2";
154 
155  // 在程序初始化时打开日志
156  logger_open(logfile, procname, cfg);
157 
158 #if defined(VC2003) || defined(VC2002) || defined(VC6)
159 
160  // 会写日志
161 
162  logger("%s(%d), %s: %s", __FILE__, __LINE__, __FUNCTION__, "zsx");
163 
164  logger_debug(DEBUG_TEST1, 1, "%s(%d), %s: hello world11(%s)!",
165  __FILE__, __LINE__, __FUNCTION__, "zsx");
166  logger_debug(DEBUG_TEST2, 3, "%s(%d), %s: hello world12(%s)!",
167  __FILE__, __LINE__, __FUNCTION__, "zsx");
168  logger_debug(DEBUG_TEST3, 2, "%s(%d), %s: hello world13(%s)!",
169  __FILE__, __LINE__, __FUNCTION__, "zsx");
170 
171  // 不会写日志
172 
173  logger_debug(DEBUG_TEST1, 3, "%s(%d), %s: hello world21(%s)!",
174  __FILE__, __LINE__, __FUNCTION__, "zsx");
175 
176 #else // VC2005, VC2008, VC2010
177 
178  // 会写日志
179 
180  logger("error(%s)!", "zsx");
181 
182  logger_debug(DEBUG_TEST1, 1, "hello world11(%s)!", "zsx");
183  logger_debug(DEBUG_TEST2, 3, "hello world12(%s)!", "zsx");
184  logger_debug(DEBUG_TEST3, 2, "hello world13(%s)!", "zsx");
185 
186  // 不会写日志
187 
188  logger_debug(DEBUG_TEST1, 3, "hello world21(%s)!", "zsx");
189 
190 #endif
191 
192  // 程序结束前关闭日志
193  logger_close();
194  }
#define logger(fmt, args...)
Definition: log.hpp:43
#define logger_open
Definition: log.hpp:5
#define logger_close
Definition: log.hpp:6
#define DEBUG_TEST1
#define DEBUG_TEST3
#define logger_debug(section, level, fmt, args...)
Definition: log.hpp:51
#define DEBUG_TEST2

引用了 DEBUG_TEST1, DEBUG_TEST2, DEBUG_TEST3, logger, logger_close, logger_debug , 以及 logger_open.

◆ logger_test2()

static void acl::log::logger_test2 ( void  )
inlinestatic

在文件 log.hpp195 行定义.

196  {
197  logger("logger ok!");
198  logger_warn("logger_warn ok!");
199  logger_error("logger_error ok!");
200  logger_fatal("logger_fatal ok!");
201  }
#define logger(fmt, args...)
Definition: log.hpp:43
#define logger_fatal(fmt, args...)
Definition: log.hpp:49
#define logger_error(fmt, args...)
Definition: log.hpp:47
#define logger_warn(fmt, args...)
Definition: log.hpp:45

引用了 logger, logger_error, logger_fatal , 以及 logger_warn.

◆ open()

static void acl::log::open ( const char *  recipients,
const char *  procname = "unknown",
const char *  cfg = NULL 
)
static

打开日志文件, 在程序初始化里调用本函数一次

参数
recipients{const char*} 日志接收器列表,由 "|" 分隔,接收器 可以是本地文件或远程套接口,如: /tmp/test.log|UDP:127.0.0.1:12345|TCP:127.0.0.1:12345|UNIX:/tmp/test.sock 该配置要求将所有日志同时发给 /tmp/test.log, UDP:127.0.0.1:12345, TCP:127.0.0.1:12345 和 UNIX:/tmp/test.sock 四个日志接收器对象
procname程序名, 如: test
cfg调试日志配置, 格式为: {section}:{level}; {section}:{level}; ... 如: 100:2; 101:3; 102: 4, 表示只记录标识为 100/级别 < 2, 以及标识为 101/级别 < 3, 以及标识为 102/级别 < 4 的日志项

◆ stdout_open()

static void acl::log::stdout_open ( bool  onoff)
static

当未通过 open 打开日志流而调用记日志等相关函数时是否需要将信息 输出至标准输出

参数
onoff{bool}

◆ verror2()

static void acl::log::verror2 ( const char *  fmt,
va_list  ap 
)
static

◆ verror5()

static void acl::log::verror5 ( const char *  fname,
int  line,
const char *  func,
const char *  fmt,
va_list  ap 
)
static

◆ vfatal2()

static void acl::log::vfatal2 ( const char *  fmt,
va_list  ap 
)
static

◆ vfatal5()

static void acl::log::vfatal5 ( const char *  fname,
int  line,
const char *  func,
const char *  fmt,
va_list  ap 
)
static

◆ vmsg2()

static void static void int const char const char static void size_t const char static void size_t const char int const char const char static void static void int const char const char static void static void int const char const char static void static void int const char const char static void acl::log::vmsg2 ( const char *  fmt,
va_list  ap 
)
static

◆ vmsg4()

static void acl::log::vmsg4 ( size_t  section,
size_t  level,
const char *  fmt,
va_list  ap 
)
static

◆ vmsg5()

static void acl::log::vmsg5 ( const char *  fname,
int  line,
const char *  func,
const char *  fmt,
va_list  ap 
)
static

◆ vmsg7()

static void acl::log::vmsg7 ( size_t  section,
size_t  level,
const char *  fname,
int  line,
const char *  func,
const char *  fmt,
va_list  ap 
)
static

◆ vwarn2()

static void acl::log::vwarn2 ( const char *  fmt,
va_list  ap 
)
static

◆ vwarn5()

static void acl::log::vwarn5 ( const char *  fname,
int  line,
const char *  func,
const char *  fmt,
va_list  ap 
)
static

类成员变量说明

◆ fmt [1/6]

void static void int const char const char* acl::log::fmt

在文件 log.hpp105 行定义.

◆ fmt [2/6]

void static void int const char const char static void size_t const char* acl::log::fmt

在文件 log.hpp107 行定义.

◆ fmt [3/6]

void static void int const char const char static void size_t const char static void size_t const char int const char const char* acl::log::fmt

在文件 log.hpp108 行定义.

◆ fmt [4/6]

void static void int const char const char static void size_t const char static void size_t const char int const char const char static void static void int const char const char* acl::log::fmt

在文件 log.hpp112 行定义.

◆ fmt [5/6]

void static void int const char const char static void size_t const char static void size_t const char int const char const char static void static void int const char const char static void static void int const char const char* acl::log::fmt

在文件 log.hpp116 行定义.

◆ fmt [6/6]

void static void int const char const char static void size_t const char static void size_t const char int const char const char static void static void int const char const char static void static void int const char const char static void static void int const char const char* acl::log::fmt

在文件 log.hpp120 行定义.

◆ fname

void static void int const char const char static void size_t const char static void size_t const char* acl::log::fname

在文件 log.hpp108 行定义.

◆ func [1/5]

void static void int const char* acl::log::func

在文件 log.hpp105 行定义.

◆ func [2/5]

void static void int const char const char static void size_t const char static void size_t const char int const char* acl::log::func

在文件 log.hpp108 行定义.

◆ func [3/5]

void static void int const char const char static void size_t const char static void size_t const char int const char const char static void static void int const char* acl::log::func

在文件 log.hpp112 行定义.

◆ func [4/5]

void static void int const char const char static void size_t const char static void size_t const char int const char const char static void static void int const char const char static void static void int const char* acl::log::func

在文件 log.hpp116 行定义.

◆ func [5/5]

void static void int const char const char static void size_t const char static void size_t const char int const char const char static void static void int const char const char static void static void int const char const char static void static void int const char* acl::log::func

在文件 log.hpp120 行定义.

◆ level [1/2]

void static void int const char const char static void size_t acl::log::level

在文件 log.hpp107 行定义.

◆ level [2/2]

void static void int const char const char static void size_t const char static void size_t acl::log::level

在文件 log.hpp108 行定义.

◆ line [1/5]

void static void int acl::log::line

在文件 log.hpp105 行定义.

◆ line [2/5]

void static void int const char const char static void size_t const char static void size_t const char int acl::log::line

在文件 log.hpp108 行定义.

◆ line [3/5]

void static void int const char const char static void size_t const char static void size_t const char int const char const char static void static void int acl::log::line

在文件 log.hpp112 行定义.

◆ line [4/5]

void static void int const char const char static void size_t const char static void size_t const char int const char const char static void static void int const char const char static void static void int acl::log::line

在文件 log.hpp116 行定义.

◆ line [5/5]

void static void int const char const char static void size_t const char static void size_t const char int const char const char static void static void int const char const char static void static void int const char const char static void static void int acl::log::line

在文件 log.hpp120 行定义.


该类的文档由以下文件生成: