diff options
Diffstat (limited to 'ACE/ace/Log_Record.cpp')
-rw-r--r-- | ACE/ace/Log_Record.cpp | 38 |
1 files changed, 25 insertions, 13 deletions
diff --git a/ACE/ace/Log_Record.cpp b/ACE/ace/Log_Record.cpp index 299b66bb480..37501bb1749 100644 --- a/ACE/ace/Log_Record.cpp +++ b/ACE/ace/Log_Record.cpp @@ -8,6 +8,7 @@ #include "ace/CDR_Stream.h" #include "ace/Auto_Ptr.h" #include "ace/Truncate.h" +#include "ace/Log_Category.h" #if !defined (__ACE_INLINE__) # include "ace/Log_Record.inl" @@ -105,17 +106,17 @@ ACE_Log_Record::dump (void) const #if defined (ACE_HAS_DUMP) // ACE_TRACE ("ACE_Log_Record::dump"); - ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); - ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("length_ = %d\n"), this->length_)); - ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\ntype_ = %u\n"), this->type_)); - ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\ntime_stamp_ = (%:, %d)\n"), + ACELIB_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); + ACELIB_DEBUG ((LM_DEBUG, ACE_TEXT ("length_ = %d\n"), this->length_)); + ACELIB_DEBUG ((LM_DEBUG, ACE_TEXT ("\ntype_ = %u\n"), this->type_)); + ACELIB_DEBUG ((LM_DEBUG, ACE_TEXT ("\ntime_stamp_ = (%:, %d)\n"), this->secs_, this->usecs_)); - ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\npid_ = %u\n"), this->pid_)); - ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\nmsg_data_ (0x%@) = %s\n"), + ACELIB_DEBUG ((LM_DEBUG, ACE_TEXT ("\npid_ = %u\n"), this->pid_)); + ACELIB_DEBUG ((LM_DEBUG, ACE_TEXT ("\nmsg_data_ (0x%@) = %s\n"), this->msg_data_, this->msg_data_)); - ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\nmsg_data_size_ = %B\n"), + ACELIB_DEBUG ((LM_DEBUG, ACE_TEXT ("\nmsg_data_size_ = %B\n"), this->msg_data_size_)); - ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); + ACELIB_DEBUG ((LM_DEBUG, ACE_END_DUMP)); #endif /* ACE_HAS_DUMP */ } @@ -146,7 +147,8 @@ ACE_Log_Record::ACE_Log_Record (ACE_Log_Priority lp, usecs_ (0), pid_ (ACE_UINT32 (p)), msg_data_ (0), - msg_data_size_ (0) + msg_data_size_ (0), + category_(0) { // ACE_TRACE ("ACE_Log_Record::ACE_Log_Record"); ACE_NEW_NORETURN (this->msg_data_, ACE_TCHAR[MAXLOGMSGLEN]); @@ -166,7 +168,8 @@ ACE_Log_Record::ACE_Log_Record (ACE_Log_Priority lp, usecs_ ((ACE_UINT32) ts.usec ()), pid_ (ACE_UINT32 (p)), msg_data_ (0), - msg_data_size_ (0) + msg_data_size_ (0), + category_(0) { // ACE_TRACE ("ACE_Log_Record::ACE_Log_Record"); ACE_NEW_NORETURN (this->msg_data_, ACE_TCHAR[MAXLOGMSGLEN]); @@ -197,7 +200,8 @@ ACE_Log_Record::ACE_Log_Record (void) usecs_ (0), pid_ (0), msg_data_ (0), - msg_data_size_ (0) + msg_data_size_ (0), + category_(0) { // ACE_TRACE ("ACE_Log_Record::ACE_Log_Record"); ACE_NEW_NORETURN (this->msg_data_, ACE_TCHAR[MAXLOGMSGLEN]); @@ -269,12 +273,20 @@ ACE_Log_Record::format_msg (const ACE_TCHAR host_name[], return 0; } +inline bool +log_priority_enabled(ACE_Log_Category_TSS* category, ACE_Log_Priority priority) +{ + if (category && !category->log_priority_enabled (priority)) + return false; + return ACE_LOG_MSG->log_priority_enabled (priority); +} + int ACE_Log_Record::print (const ACE_TCHAR host_name[], u_long verbose_flag, FILE *fp) { - if (ACE_LOG_MSG->log_priority_enabled (ACE_Log_Priority (this->type_))) + if ( log_priority_enabled(this->category(), ACE_Log_Priority (this->type_)) ) { ACE_TCHAR *verbose_msg = 0; ACE_NEW_RETURN (verbose_msg, ACE_TCHAR[MAXVERBOSELOGMSGLEN], -1); @@ -374,7 +386,7 @@ ACE_Log_Record::print (const ACE_TCHAR host_name[], u_long verbose_flag, ACE_OSTREAM_TYPE &s) { - if (ACE_LOG_MSG->log_priority_enabled (ACE_Log_Priority (this->type_))) + if ( log_priority_enabled(this->category(), ACE_Log_Priority (this->type_)) ) { ACE_TCHAR* verbose_msg = 0; ACE_NEW_RETURN (verbose_msg, ACE_TCHAR[MAXVERBOSELOGMSGLEN], -1); |