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 sequence
LM_DEBUG Debugging information
LM_INFO Messages that contain information normally of use only when debugging a program
LM_NOTICE Conditions that are not error conditions but that may require special handling
LM_WARNING Warning messages
LM_ERROR Error messages
LM_CRITICAL Critical conditions, such as hard device errors
LM_ALERT A condition that should be corrected immediately, such as a corrupted database
LM_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 — 当前进程ID
p ACE_TCHAR* 字符串,后接错误号,同perror
Q 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 — 当前线程ID
u int 无符号十进制整数
w wchar_t Single wide character
W wchar_t* Wide-character string
x,X int 十六进制数
@ void* 指针(十六进制)
% N/A %