http://wenku.baidu.com/link?url=dK6j9_0pICRjxWW7usBlkCxPTa8zFSPyUe_uWAkwMPFDU4ip_tEfxpOitxjkl3RuPy3D7g7YeAyyH1TFj69F0CR0b-1uuqmvBIcMcyD94Ca 可以看出ACE日志系统的宏调用非常简单: ACE_XXX((severity, formatting-args));
其中,ACE_XXX表示日志输出宏(ACE Logging Macros),包括:ACE_ERROR((level, string, ...))ACE_DEBUG((level, string, ...))ACE_TRACE(string)ACE_ASSERT(test)ACE_HEX_DUMP((level, buffer, size [,text]))ACE_RETURN(value)ACE_ERROR_RETURN((level, string, ...), value)ACE_ERROR_INIT( value, flags )ACE_ERROR_BREAK((level, string, ...))
severity即输出的严重等级(Severity Level),包括:LM_TRACE Messages indicating function-calling sequenceLM_DEBUG Debugging informationLM_INFO Messages that contain information normally of use only when debugging a programLM_NOTICE Conditions that are not error conditions but that may require special handlingLM_WARNING Warning messagesLM_ERROR Error messagesLM_CRITICAL Critical conditions, such as hard device errorsLM_ALERT A condition that should be corrected immediately, such as a corrupted databaseLM_EMERGENCY A panic condition, normally broadcast to all usersLM_TRACE Messages indicating function-calling sequence
formatting-args是要输出的内容,格式类似于printf函数的输出格式:
Code Argument Type Displays
A ACE_timer_t 浮点数a — 导致程序终止(Abort)c char 单个字符C char* 字符串(narrow characters)i,d int 10进制整数I — 缩进e,E,f,F,g,G double 双精度浮点数l — 行号M — severity level的名称m — 错误号(errorno)N — 文件名n — ACE_Log_Msg::open()指定的程序名o int 八进制整数P — 当前进程IDp ACE_TCHAR* 字符串,后接错误号,同perrorQ ACE_UINT64 64位无符号十进制整数r void (*)() 函数调用R int 十进制整数S int 数字对应的信号名称s ACE_TCHAR* ACE_TCHAR类型的字符串T — 当前时间(hour:minute:sec.usec)D — 时戳(month/day/year/hour:minute:sec.usec)t — 当前线程IDu int 无符号十进制整数w wchar_t Single wide characterW wchar_t* Wide-character stringx,X int 十六进制数@ void* 指针(十六进制)% N/A %
时间: 2024-11-13 04:09:33