diff options
author | William R. Otte <wotte@dre.vanderbilt.edu> | 2006-07-24 15:50:30 +0000 |
---|---|---|
committer | William R. Otte <wotte@dre.vanderbilt.edu> | 2006-07-24 15:50:30 +0000 |
commit | c44379cc7d9c7aa113989237ab0f56db12aa5219 (patch) | |
tree | 66a84b20d47f2269d8bdc6e0323f338763424d3a /ACE/examples/APG/Logging/Callback-2.h | |
parent | 3aff90f4a822fcf5d902bbfbcc9fa931d6191a8c (diff) | |
download | ATCD-c44379cc7d9c7aa113989237ab0f56db12aa5219.tar.gz |
Repo restructuring
Diffstat (limited to 'ACE/examples/APG/Logging/Callback-2.h')
-rw-r--r-- | ACE/examples/APG/Logging/Callback-2.h | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/ACE/examples/APG/Logging/Callback-2.h b/ACE/examples/APG/Logging/Callback-2.h new file mode 100644 index 00000000000..906b2e43286 --- /dev/null +++ b/ACE/examples/APG/Logging/Callback-2.h @@ -0,0 +1,44 @@ +// $Id$ + +#ifndef APG_CALLBACK2_H +#define APG_CALLBACK2_H + +#include "ace/OS_NS_time.h" +#include "ace/streams.h" +#include "ace/Log_Msg_Callback.h" +#include "ace/Log_Record.h" +#include "ace/SString.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); + const ACE_TCHAR *prio_name = + ACE_Log_Record::priority_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; + } +}; + +#endif /* APG_CALLBACK2_H */ |