diff options
author | nanbor <nanbor@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1998-04-10 08:07:06 +0000 |
---|---|---|
committer | nanbor <nanbor@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1998-04-10 08:07:06 +0000 |
commit | e9b36d4151f8adf6736a21b5b68869e6cd989bb6 (patch) | |
tree | d8f427ee2a0f9a99c56f86ae856efc2bbe89c3ae | |
parent | e5fd20c4dd59816aaa3d676d23f99263eee7c82e (diff) | |
download | ATCD-e9b36d4151f8adf6736a21b5b68869e6cd989bb6.tar.gz |
Added CE specialization
-rw-r--r-- | ace/Log_Msg.cpp | 10 | ||||
-rw-r--r-- | ace/Log_Record.cpp | 46 | ||||
-rw-r--r-- | ace/Log_Record.h | 13 |
3 files changed, 65 insertions, 4 deletions
diff --git a/ace/Log_Msg.cpp b/ace/Log_Msg.cpp index 32ffc156c33..e830bdba177 100644 --- a/ace/Log_Msg.cpp +++ b/ace/Log_Msg.cpp @@ -947,9 +947,13 @@ ACE_Log_Msg::log (ACE_Log_Record &log_record, if (ACE_BIT_ENABLED (ACE_Log_Msg::flags_, ACE_Log_Msg::STDERR) && !suppress_stderr) // This is taken care of by our caller. - log_record.print (ACE_Log_Msg::local_host_, - ACE_BIT_ENABLED (ACE_Log_Msg::flags_, ACE_Log_Msg::VERBOSE), - stderr); + log_record.print (ACE_Log_Msg::local_host_ + ,ACE_BIT_ENABLED (ACE_Log_Msg::flags_, ACE_Log_Msg::VERBOSE) +#if defined (ACE_HAS_WINCE) + ); +#else + ,stderr); +#endif if (ACE_BIT_ENABLED (ACE_Log_Msg::flags_, ACE_Log_Msg::LOGGER)) diff --git a/ace/Log_Record.cpp b/ace/Log_Record.cpp index f2143f46bd9..b9b7e97fc67 100644 --- a/ace/Log_Record.cpp +++ b/ace/Log_Record.cpp @@ -176,4 +176,50 @@ ACE_Log_Record::print (const ASYS_TCHAR host_name[], s.flush (); return 0; } +#else /* ACE_HAS_WINCE */ +int +ACE_Log_Record::print (const ASYS_TCHAR *host_name, + int verbose, + ACE_CE_Bridge *log_window) +{ + // ACE_TRACE ("ACE_Log_Record::print"); + + int ret; + CString *msg = new CString (); + + if (verbose) + { + time_t now = this->time_stamp_.sec (); + ASYS_TCHAR ctp[26]; // 26 is a magic number... + + if (ACE_OS::ctime_r (&now, ctp, sizeof ctp) == 0) + return -1; + + /* 01234567890123456789012345 */ + /* Wed Oct 18 14:25:36 1989n0 */ + + ctp[19] = '\0'; // NUL-terminate after the time. + ctp[24] = '\0'; // NUL-terminate after the date. + + const ASYS_TCHAR *lhost_name = host_name == + 0 ? ASYS_TEXT ("<local_host>") : host_name; + + msg->Format (ASYS_TEXT ("%s.%d %s@%s@%d@%d@%s"), + ctp + 4, + this->time_stamp_.usec () / 1000, + ctp + 20, + lhost_name, + this->pid_, + this->type_, + this->msg_data_); + } + 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 ret; +} #endif /* ! ACE_HAS_WINCE */ diff --git a/ace/Log_Record.h b/ace/Log_Record.h index 0e8a99a9288..873da7bd5df 100644 --- a/ace/Log_Record.h +++ b/ace/Log_Record.h @@ -55,18 +55,29 @@ public: // Create a <Log_Record> and set its priority, time stamp, and // process id. +#if !defined (ACE_HAS_WINCE) // @@ Sould this be ACE_LACKS_IOSTREAM_TOTALLY? int print (const ASYS_TCHAR host_name[], int verbose = 1, FILE *fp = stderr); // Write the contents of the logging record to the appropriate // <FILE>. -#if !defined (ACE_HAS_WINCE) // @@ Sould this be ACE_LACKS_IOSTREAM_TOTALLY? int print (const ASYS_TCHAR host_name[], int verbose, ostream &stream); // Write the contents of the logging record to the appropriate // <ostream>. +#else + int print (const ASYS_TCHAR host_name[], + int verbose, + FILE *fp); + // Write the contents of the logging record to the appropriate + // <FILE>. + + int print (const ASYS_TCHAR host_name[], + int verbose = 1, + ACE_CE_Bridge *log_ = 0); + // For Windows CE, the default is to log messages to a preset window. #endif /* ! ACE_HAS_WINCE */ // = Marshall/demarshall |