reSIProcate/rutil  9694
Public Member Functions | Private Member Functions | Private Attributes
resip::Log::Guard Class Reference

Implementation for logging macros. More...

#include <Log.hxx>

Collaboration diagram for resip::Log::Guard:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 Guard (Level level, const Subsystem &system, const char *file, int line)
 Remember the logging values and be a a stream to receive the log contents.
 ~Guard ()
 Commit logging.
EncodeStream & asStream ()
 operator EncodeStream & ()

Private Member Functions

Guardoperator= (const Guard &)

Private Attributes

resip::Log::Level mLevel
const resip::SubsystemmSubsystem
resip::Data::size_type mHeaderLength
const char * mFile
int mLine
char mBuffer [128]
Data mData
oDataStream mStream

Detailed Description

Implementation for logging macros.

Log::Guard(Log::Info, Subsystem::TEST, __FILE__, __LINE__) << ... ;

Definition at line 102 of file Log.hxx.


Constructor & Destructor Documentation

Log::Guard::Guard ( Level  level,
const Subsystem system,
const char *  file,
int  line 
)

Remember the logging values and be a a stream to receive the log contents.

Definition at line 705 of file Log.cxx.

References resip::Log::delim, resip::Log::getLoggerData(), mData, mFile, mHeaderLength, mLevel, mLine, mStream, mSubsystem, resip::Log::OnlyExternalNoHeaders, resip::Data::size(), and resip::Log::tags().

Here is the call graph for this function:

Log::Guard::~Guard ( )

Commit logging.

Definition at line 731 of file Log.cxx.

References resip::Log::_mutex, resip::Log::getAppName(), resip::Log::getExternal(), resip::Log::getLoggerData(), resip::Log::Instance(), resip::Log::ThreadData::mType, resip::Log::OnlyExternal, resip::Log::OnlyExternalNoHeaders, resip::Log::OutputToWin32DebugWindow(), resip::Data::Share, and resip::Log::VSDebugWindow.

{
   mStream.flush();

   if (resip::Log::getExternal())
   {
      const resip::Data rest(resip::Data::Share,
                             mData.data() + mHeaderLength,
                             (int)mData.size() - mHeaderLength);
      if (!(*resip::Log::getExternal())(mLevel, 
                                        mSubsystem, 
                                        resip::Log::getAppName(),
                                        mFile,
                                        mLine, 
                                        rest, 
                                        mData))
      {
         return;
      }
   }
    
   Type logType = resip::Log::getLoggerData().mType;

   if(logType == resip::Log::OnlyExternal ||
      logType == resip::Log::OnlyExternalNoHeaders) 
   {
      return;
   }

   resip::Lock lock(resip::Log::_mutex);
   // !dlb! implement VSDebugWindow as an external logger
   if (logType == resip::Log::VSDebugWindow)
   {
      mData += "\r\n";
      OutputToWin32DebugWindow(mData);
   }
   else 
   {
      // endl is magic in syslog -- so put it here
      Instance((int)mData.size()+2) << mData << std::endl;  
   }
}

Here is the call graph for this function:


Member Function Documentation

EncodeStream& resip::Log::Guard::asStream ( ) [inline]

Definition at line 115 of file Log.hxx.

References mStream.

{return mStream;}
resip::Log::Guard::operator EncodeStream & ( ) [inline]

Definition at line 116 of file Log.hxx.

References mStream.

{return mStream;}
Guard& resip::Log::Guard::operator= ( const Guard ) [private]

Member Data Documentation

char resip::Log::Guard::mBuffer[128] [private]

Definition at line 124 of file Log.hxx.

Definition at line 125 of file Log.hxx.

Referenced by Guard().

const char* resip::Log::Guard::mFile [private]

Definition at line 122 of file Log.hxx.

Referenced by Guard().

Definition at line 121 of file Log.hxx.

Referenced by Guard().

Definition at line 119 of file Log.hxx.

Referenced by Guard().

int resip::Log::Guard::mLine [private]

Definition at line 123 of file Log.hxx.

Referenced by Guard().

Definition at line 126 of file Log.hxx.

Referenced by asStream(), Guard(), and operator EncodeStream &().

Definition at line 120 of file Log.hxx.

Referenced by Guard().


The documentation for this class was generated from the following files: