diff options
author | nanbor <nanbor@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1998-05-21 22:11:26 +0000 |
---|---|---|
committer | nanbor <nanbor@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1998-05-21 22:11:26 +0000 |
commit | 3d0d0259f7c208c03fa9780d4d00397a339402fb (patch) | |
tree | d516127de7ae66b4208ada7a0c51cfe6360ec704 /ace | |
parent | 90c7c2b868e563788213bc3b1f0c811918c8b7e1 (diff) | |
download | ATCD-3d0d0259f7c208c03fa9780d4d00397a339402fb.tar.gz |
Generalized message formatting on CE
Diffstat (limited to 'ace')
-rw-r--r-- | ace/Log_Record.cpp | 54 | ||||
-rw-r--r-- | ace/Log_Record.h | 4 |
2 files changed, 46 insertions, 12 deletions
diff --git a/ace/Log_Record.cpp b/ace/Log_Record.cpp index e213ade8c82..5cec0951a40 100644 --- a/ace/Log_Record.cpp +++ b/ace/Log_Record.cpp @@ -116,6 +116,7 @@ ACE_Log_Record::ACE_Log_Record (void) // Print out the record on the stderr stream with the appropriate // format. +#if !defined (ACE_HAS_WINCE) int ACE_Log_Record::print (const ASYS_TCHAR *host_name, u_long verbose_flag, @@ -167,7 +168,6 @@ ACE_Log_Record::print (const ASYS_TCHAR *host_name, return ret; } -#if !defined (ACE_HAS_WINCE) int ACE_Log_Record::print (const ASYS_TCHAR host_name[], u_long verbose_flag, @@ -215,15 +215,10 @@ ACE_Log_Record::print (const ASYS_TCHAR host_name[], } #else /* ACE_HAS_WINCE */ int -ACE_Log_Record::print (const ASYS_TCHAR *host_name, - u_long verbose_flag, - ACE_CE_Bridge *log_window) +ACE_Log_Record::format_msg (const ASYS_TCHAR host_name[], + u_long verbose_flag, + CString *msg) { - // ACE_TRACE ("ACE_Log_Record::print"); - - int ret; - CString *msg = new CString (); - if (ACE_BIT_ENABLED (verbose_flag, ACE_Log_Msg::VERBOSE)) { time_t now = this->time_stamp_.sec (); @@ -257,10 +252,45 @@ ACE_Log_Record::print (const ASYS_TCHAR *host_name, else msg->Format (ASYS_TEXT ("%s"), this->msg_data_); - if (log_window == 0) - log_window = ACE_CE_Bridge::get_default_winbridge (); - log_window->write_msg (msg); + return 0; +} + +int +ACE_Log_Record::print (const ASYS_TCHAR *host_name, + u_long verbose_flag, + FILE *fp) +{ + int ret = -1; + CString msg; + if (this->format_msg (host_name, verbose_flag, &msg) != -1 && + fp != NULL) + { + ret = ACE_OS::fwrite (ACE_MULTIBYTE_STRING (msg), + 1, + msg.GetLength (), + fp); + } return ret; } + +int +ACE_Log_Record::print (const ASYS_TCHAR *host_name, + u_long verbose_flag, + ACE_CE_Bridge *log_window) +{ + // ACE_TRACE ("ACE_Log_Record::print"); + + CString *msg = new CString (); + + if (this->format_msg (host_name, verbose_flag, msg) != -1) + { + if (log_window == 0) + log_window = ACE_CE_Bridge::get_default_winbridge (); + log_window->write_msg (msg); + return 0; + } + + return -1; +} #endif /* ! ACE_HAS_WINCE */ diff --git a/ace/Log_Record.h b/ace/Log_Record.h index 425bf57082c..1d5883c7f08 100644 --- a/ace/Log_Record.h +++ b/ace/Log_Record.h @@ -71,6 +71,10 @@ public: // Write the contents of the logging record to the appropriate // <ostream>. #else + int format_msg (const ASYS_TCHAR host_name[], + u_long verbose_flag, + CString *msg); + int print (const ASYS_TCHAR host_name[], u_long verbose_flag, FILE *fp); |