MsgLogger/src/MsgLogger.cpp

Go to the documentation of this file.
00001 //--------------------------------------------------------------------------
00002 // File and Version Information:
00003 //      $Id: MsgLogger.cpp 2550 2011-10-24 21:37:19Z salnikov@SLAC.STANFORD.EDU $
00004 //
00005 // Description:
00006 //      Class MsgLogger
00007 //
00008 // Environment:
00009 //      Software developed for the BaBar Detector at the SLAC B-Factory.
00010 //
00011 // Author List:
00012 //      Andy Salnikov
00013 //
00014 // Copyright Information:
00015 //      Copyright (C) 2005 SLAC
00016 //
00017 //------------------------------------------------------------------------
00018 
00019 //-----------------------
00020 // This Class's Header --
00021 //-----------------------
00022 #include "MsgLogger/MsgLogger.h"
00023 
00024 //-------------
00025 // C Headers --
00026 //-------------
00027 extern "C" {
00028 }
00029 
00030 //---------------
00031 // C++ Headers --
00032 //---------------
00033 
00034 //-------------------------------
00035 // Collaborating Class Headers --
00036 //-------------------------------
00037 #include "MsgLogger/MsgLoggerImpl.h"
00038 
00039 //-----------------------------------------------------------------------
00040 // Local Macros, Typedefs, Structures, Unions and Forward Declarations --
00041 //-----------------------------------------------------------------------
00042 
00043 namespace MsgLogger {
00044 
00045 //              ----------------------------------------
00046 //              -- Public Function Member Definitions --
00047 //              ----------------------------------------
00048 
00049 // Construct a logger
00050 MsgLogger::MsgLogger( const std::string& name )
00051   : _impl ( MsgLoggerImpl::getLogger(name) )
00052 {
00053 }
00054 
00055 /// set the logger level, messages with the level below this won't be logged
00056 void
00057 MsgLogger::setLevel ( MsgLogLevel level )
00058 {
00059   if ( _impl ) _impl->setLevel ( level ) ;
00060 }
00061 
00062 /// define wheter or not we need messages propagated to ancestors
00063 void
00064 MsgLogger::propagate ( bool flag )
00065 {
00066   if ( _impl ) _impl->propagate( flag ) ;
00067 }
00068 
00069 /// add a handler for the messages, takes ownership of the object
00070 void
00071 MsgLogger::addHandler ( MsgHandler* handler )
00072 {
00073   if ( _impl ) _impl->addHandler ( handler ) ;
00074 }
00075 
00076 
00077 /// check if the specified level will log any message
00078 bool
00079 MsgLogger::logging ( MsgLogLevel sev ) const
00080 {
00081   return _impl ? _impl->logging ( sev ) : false ;
00082 }
00083 
00084 /// get the stream for the specified log level
00085 bool
00086 MsgLogger::log ( const MsgLogRecord& record ) const
00087 {
00088   return _impl ? _impl->log ( record ) : false ;
00089 }
00090 
00091 
00092 } // namespace MsgLogger

Generated on 19 Dec 2016 for PSANAclasses by  doxygen 1.4.7