This is my first ACE article, I hope everyone can like it ------------------------ ACE provides very flexible, convenient log management and news Output function, do some simple and direct functions below
ACE_DEBUG Some Output Messages ACE_ERROR will provide some low-level messages that have an error
The use of two macros is consistent with ACE_DEBUG (error level, "format string", variable 1 ... variable n) where part of the error level system is defined as follows: LM_SHUTDOWN = 01, the system crash level LM_TRACE = 02, track level lm_debug = 04, DEBUG level LM_INFO = 010, regular information level LM_NOTICE = 020, pay attention to LM_WARNING = 040, warning level lm_startup = 0100, start level lm_error = 0200, error level LM_Critical = 0400, critical level lm_alert = 01000, repairable warning level LM_EMERGENCY = 02000, global warning level part of the format string is used as follows: Printf in c, using similar% N-table Current program name% T-table Current line number% P-table pointer% S-string ACE ACE_LOG_MSG Manage and control output, we can use this instance to redirect the output to the file, or redirect to the flag Out, which can also control what level of message can be output, simply use as follows:
ACE_LOG_MSG-> set_flags (ACE_Log_Msg :: STDERR); sets the output to the standard error output ACE_LOG_MSG-> clr_flags (ACE_Log_Msg :: STDERR); Close flag is output to the error output ACE_LOG_MSG-> set_flags (ACE_Log_Msg :: OSTREAM); ofstream myostream (filename, ios :: out | ios :: trunc); ACE_LOG_MSG-> msg_ostream (& myostream); provided to the output file u_long priority_mask = ACE_LOG_MSG-> priority_mask (ACE_Log_Msg :: PROCESS); ACE_SET_BITS (priority_mask, LM_DEBUG | LM_INFO); provided only records LM_DEBUG Or LM_INFO level message ACE_CLR_BITS (priority_mask, lm_debug | lm_info); clear setting condition ACE_LOG_MSG has a very interesting function, can output blocks in memory in a 16-way method, simply use: ACE_LOG_MSG-> log_hexdump (lm_debug, Char *) Array, SizeOf Array;