The
new ACE has canceled the use of Ace_static_case macros, using static_cast as a direct conversion. In response to this change, a change was made to the 47-page example in the APG book:
#include "ace/streams.h" #include "ace/log_msg_callback.h" #include "ace/log_record.h" #include "ace/sstring.h" # Include "Ace/os_ns_time.h" #include "ace/time_value.h" class Callback:public Ace_log_msg_callback {public:void Log (Ace _log_record &log_record) {cerr << "Log Message Received:" << Endl; unsigned long msg_severity = Log_record.type (); Ace_log_priority Prio = static_cast<ace_log_priority> (msg_severity);//(ace_log_priority) msg_severity; Const Ace_tchar *prio_name = Ace_log_record::p riority_name (Prio); Cerr << "/ttype:" << Ace_text_always_char (prio_name) << Endl; Cerr << "/tlength:" << log_record.length () << Endl; Const time_t epoch = Log_record.time_stamp (). SEC (); Cerr << "/ttime_stamp:" << Ace_text_always_char (Ace_os::ctime (&epoch)) << flush; Cerr << "/tpid:" << log_record.pid () << Endl; Ace_cstring data (">>"); Data + = Ace_text_always_char (Log_record.msg_data ()); CeRR << "/tmsgdata:" << data.c_str () << Endl;}};
Reference: Ace Programmer's Guide: Using Design patterns for network and system programming