slic::LogStream Class Reference

#include <LogStream.hh>

Collaboration diagram for slic::LogStream:

Collaboration graph
[legend]

List of all members.


Detailed Description

LogStream provides methods for logging messages at a certain level. The LogStream has a default level, and if a message's log level is greater than the current log level, it is discarded.

The stream operators are overloaded so that the LogStream can be used similarly to std::cout.

The manipulator LOG::done should be used to terminate a log message.

Some of the code, particularly the handling of ios manipulators, is based on Gaudi's MsgStream class.

Definition at line 61 of file LogStream.hh.


Public Member Functions

const std::string & getName () const
bool isActive () const
LOG::ELevel getOutputLevel () const
ostream & getOutputStream () const
void setOutputLevel (const LOG::ELevel &outputLevel)
LogStreamoperator<< (const LOG::ELevel &x)
LogStreamoperator<< (const LOG::EManip &x)
LogStreamoperator<< (const std::_Setiosflags &manip)
LogStreamoperator<< (const std::_Resetiosflags &manip)
LogStreamoperator<< (const std::_Setbase &manip)
LogStreamoperator<< (const std::_Setprecision &manip)
LogStreamoperator<< (const std::_Setw &manip)
LogStreamoperator<< (ios &(*manip)(std::ios &))
LogStreamoperator<< (std::ios_base &(*manip)(std::ios_base &))
template<typename T>
LogStreamoperator<< (const T &arg)
template<typename T>
LogStreamoperator<< (const std::vector< T > &v)
int width () const
int width (int v)
long flags () const
long flags (std::ios_base::fmtflags v)
long setf (std::ios_base::fmtflags v)
char fill () const
char fill (char v)
int precision () const
int precision (int v)
int rdstate () const
int good () const
int eof () const
int bad () const
long setf (std::ios_base::fmtflags _f, std::ios_base::fmtflags _m)
void unsetf (std::ios_base::fmtflags _l)
void clear (std::ios_base::iostate _i=std::ios_base::failbit)
void setOutputFile (const std::string &file)
LogStreamdebug ()
LogStreamverbose ()
LogStreamokay ()
LogStreamwarning ()
LogStreamerror ()
LogStreamfatal ()
LogStreamalways ()
void log (const std::string &mesg, const LOG::ELevel &level)
void log (const std::string &mesg)
void debug (const std::string &mesg)
void verbose (const std::string &mesg)
void okay (const std::string &mesg)
void warning (const std::string &mesg)
void error (const std::string &mesg)
void fatal (const std::string &mesg)
void always (const std::string &mesg)

Protected Member Functions

 LogStream (std::string name, LOG::ELevel level, ostream *os=&std::cout)
 LogStream ()
virtual ~LogStream ()

Private Attributes

std::string m_name
LOG::ELevel m_outputLevel
ostream * m_os
bool m_active
std::ofstream * m_fos

Friends

class LogManager

Constructor & Destructor Documentation

slic::LogStream::LogStream ( std::string  name,
LOG::ELevel  level,
ostream *  os = &std::cout 
) [inline, protected]

Definition at line 66 of file LogStream.hh.

slic::LogStream::LogStream (  )  [inline, protected]

Definition at line 76 of file LogStream.hh.

virtual slic::LogStream::~LogStream (  )  [inline, protected, virtual]

Definition at line 84 of file LogStream.hh.


Member Function Documentation

const std::string& slic::LogStream::getName (  )  const [inline]

Definition at line 92 of file LogStream.hh.

References m_name.

Referenced by slic::LogMessenger::defineCommands(), and operator<<().

bool slic::LogStream::isActive (  )  const [inline]

Definition at line 97 of file LogStream.hh.

References m_active.

Referenced by bad(), clear(), eof(), fill(), flags(), good(), operator<<(), precision(), rdstate(), setf(), unsetf(), and width().

LOG::ELevel slic::LogStream::getOutputLevel (  )  const [inline]

Definition at line 102 of file LogStream.hh.

References m_outputLevel.

Referenced by log(), and operator<<().

ostream& slic::LogStream::getOutputStream (  )  const [inline]

Definition at line 107 of file LogStream.hh.

References m_os.

Referenced by bad(), clear(), slic::LcioMcpPrinter::colLabels(), eof(), fill(), flags(), good(), operator<<(), precision(), slic::LcioMcpPrinter::printMcp(), slic::CommandLineProcessor::printOptions(), rdstate(), setf(), unsetf(), and width().

void slic::LogStream::setOutputLevel ( const LOG::ELevel outputLevel  )  [inline]

Definition at line 112 of file LogStream.hh.

References m_outputLevel.

Referenced by slic::HepPDTManager::HepPDTManager(), and slic::LogMessenger::SetNewValue().

LogStream& slic::LogStream::operator<< ( const LOG::ELevel x  )  [inline]

Stream the level of this message.

Definition at line 120 of file LogStream.hh.

References getOutputLevel(), and m_active.

LogStream& slic::LogStream::operator<< ( const LOG::EManip x  )  [inline]

Definition at line 136 of file LogStream.hh.

References LOG::done, LOG::endl, TimeUtil::getAscTime(), getName(), getOutputLevel(), getOutputStream(), LOG::head, isActive(), and levelNames.

LogStream& slic::LogStream::operator<< ( const std::_Setiosflags &  manip  )  [inline]

Definition at line 155 of file LogStream.hh.

References getOutputStream(), and isActive().

LogStream& slic::LogStream::operator<< ( const std::_Resetiosflags &  manip  )  [inline]

Definition at line 163 of file LogStream.hh.

References getOutputStream(), and isActive().

LogStream& slic::LogStream::operator<< ( const std::_Setbase &  manip  )  [inline]

Definition at line 171 of file LogStream.hh.

References getOutputStream(), and isActive().

LogStream& slic::LogStream::operator<< ( const std::_Setprecision &  manip  )  [inline]

Definition at line 179 of file LogStream.hh.

References getOutputStream(), and isActive().

LogStream& slic::LogStream::operator<< ( const std::_Setw &  manip  )  [inline]

Definition at line 187 of file LogStream.hh.

References getOutputStream(), and isActive().

LogStream& slic::LogStream::operator<< ( ios &(*)(std::ios &)  manip  )  [inline]

Definition at line 196 of file LogStream.hh.

References getOutputStream(), and isActive().

LogStream& slic::LogStream::operator<< ( std::ios_base &(*)(std::ios_base &)  manip  )  [inline]

Definition at line 205 of file LogStream.hh.

References getOutputStream(), and isActive().

template<typename T>
LogStream& slic::LogStream::operator<< ( const T &  arg  )  [inline]

Definition at line 215 of file LogStream.hh.

References getOutputStream(), and isActive().

template<typename T>
LogStream& slic::LogStream::operator<< ( const std::vector< T > &  v  )  [inline]

Definition at line 225 of file LogStream.hh.

References getOutputStream(), and isActive().

int slic::LogStream::width (  )  const [inline]

Definition at line 234 of file LogStream.hh.

References getOutputStream(), and isActive().

Referenced by slic::PhysicsListFactory::printAvailableLists().

int slic::LogStream::width ( int  v  )  [inline]

Definition at line 239 of file LogStream.hh.

References getOutputStream(), and isActive().

long slic::LogStream::flags (  )  const [inline]

Definition at line 245 of file LogStream.hh.

References getOutputStream(), and isActive().

long slic::LogStream::flags ( std::ios_base::fmtflags  v  )  [inline]

Definition at line 250 of file LogStream.hh.

References getOutputStream(), and isActive().

long slic::LogStream::setf ( std::ios_base::fmtflags  v  )  [inline]

Definition at line 255 of file LogStream.hh.

References getOutputStream(), and isActive().

char slic::LogStream::fill (  )  const [inline]

Definition at line 260 of file LogStream.hh.

References getOutputStream(), and isActive().

char slic::LogStream::fill ( char  v  )  [inline]

Definition at line 265 of file LogStream.hh.

References getOutputStream(), and isActive().

int slic::LogStream::precision (  )  const [inline]

Definition at line 270 of file LogStream.hh.

References getOutputStream(), and isActive().

int slic::LogStream::precision ( int  v  )  [inline]

Definition at line 275 of file LogStream.hh.

References getOutputStream(), and isActive().

int slic::LogStream::rdstate (  )  const [inline]

Definition at line 280 of file LogStream.hh.

References getOutputStream(), and isActive().

int slic::LogStream::good (  )  const [inline]

Definition at line 285 of file LogStream.hh.

References getOutputStream(), and isActive().

int slic::LogStream::eof (  )  const [inline]

Definition at line 290 of file LogStream.hh.

References getOutputStream(), and isActive().

int slic::LogStream::bad (  )  const [inline]

Definition at line 295 of file LogStream.hh.

References getOutputStream(), and isActive().

long slic::LogStream::setf ( std::ios_base::fmtflags  _f,
std::ios_base::fmtflags  _m 
) [inline]

Definition at line 300 of file LogStream.hh.

References getOutputStream(), and isActive().

void slic::LogStream::unsetf ( std::ios_base::fmtflags  _l  )  [inline]

Definition at line 305 of file LogStream.hh.

References getOutputStream(), and isActive().

void slic::LogStream::clear ( std::ios_base::iostate  _i = std::ios_base::failbit  )  [inline]

Definition at line 312 of file LogStream.hh.

References getOutputStream(), and isActive().

void slic::LogStream::setOutputFile ( const std::string &  file  )  [inline]

Definition at line 320 of file LogStream.hh.

References m_fos, and m_os.

Referenced by slic::LogMessenger::SetNewValue().

LogStream& slic::LogStream::debug (  )  [inline]

Definition at line 327 of file LogStream.hh.

References LOG::debug.

Referenced by slic::LcioHitsCollectionBuilder::createHitCollections(), and slic::SlicApplication::~SlicApplication().

LogStream& slic::LogStream::verbose (  )  [inline]

Definition at line 332 of file LogStream.hh.

References LOG::verbose.

Referenced by slic::Module::Module(), slic::SlicApplication::run(), slic::LcioHitsCollectionBuilder::setLongFlag(), slic::LcioHitsCollectionBuilder::setPDGFlag(), slic::LcioManager::setRunNumber(), and slic::Module::~Module().

LogStream& slic::LogStream::okay (  )  [inline]

Definition at line 337 of file LogStream.hh.

References LOG::okay.

Referenced by slic::PhysicsListFactory::create(), slic::LcioManager::makeAutoname(), slic::LcioManager::openLcioFile(), slic::StdHepLoader::openStdHepFile(), slic::LcioManager::setDetectorName(), and slic::EventSourceManager::setupEventSource().

LogStream& slic::LogStream::warning (  )  [inline]

Definition at line 342 of file LogStream.hh.

References LOG::warning.

Referenced by slic::EventAction::BeginOfEventAction(), slic::SlicApplication::initialize(), slic::LcioManager::makeAutoname(), slic::ModuleRegistry::registerModule(), and slic::EventSourceManager::setupEventSource().

LogStream& slic::LogStream::error (  )  [inline]

Definition at line 347 of file LogStream.hh.

References LOG::error.

Referenced by slic::LcioHitsCollectionBuilder::addMcpContribs(), slic::LcioHitsCollectionBuilder::createHit(), slic::StdHepLoader::dumpCurrentEvent(), slic::PhysicsListManager::initializePhysicsList(), slic::LcioManager::openLcioFile(), and slic::EventSourceManager::setupEventSource().

LogStream& slic::LogStream::fatal (  )  [inline]

Definition at line 352 of file LogStream.hh.

References LOG::fatal.

Referenced by slic::SlicApplication::initializeUI(), slic::LcioManager::openLcioFile(), and slic::StdHepLoader::readNextEvent().

LogStream& slic::LogStream::always (  )  [inline]

Definition at line 357 of file LogStream.hh.

References LOG::always.

Referenced by slic::PhysicsListManager::printAvailablePhysicsLists(), and slic::PhysicsListManager::setupExtended().

void slic::LogStream::log ( const std::string &  mesg,
const LOG::ELevel level 
) [inline]

Definition at line 362 of file LogStream.hh.

References LOG::done.

Referenced by always(), debug(), error(), fatal(), log(), okay(), verbose(), and warning().

void slic::LogStream::log ( const std::string &  mesg  )  [inline]

Definition at line 367 of file LogStream.hh.

References getOutputLevel(), and log().

void slic::LogStream::debug ( const std::string &  mesg  )  [inline]

Definition at line 372 of file LogStream.hh.

References LOG::debug, and log().

void slic::LogStream::verbose ( const std::string &  mesg  )  [inline]

Definition at line 377 of file LogStream.hh.

References log(), and LOG::verbose.

void slic::LogStream::okay ( const std::string &  mesg  )  [inline]

Definition at line 382 of file LogStream.hh.

References log(), and LOG::okay.

void slic::LogStream::warning ( const std::string &  mesg  )  [inline]

Definition at line 387 of file LogStream.hh.

References log(), and LOG::warning.

void slic::LogStream::error ( const std::string &  mesg  )  [inline]

Definition at line 392 of file LogStream.hh.

References LOG::error, and log().

void slic::LogStream::fatal ( const std::string &  mesg  )  [inline]

Definition at line 397 of file LogStream.hh.

References LOG::fatal, and log().

void slic::LogStream::always ( const std::string &  mesg  )  [inline]

Definition at line 402 of file LogStream.hh.

References LOG::always, and log().


Friends And Related Function Documentation

friend class LogManager [friend]

Definition at line 88 of file LogStream.hh.


Member Data Documentation

std::string slic::LogStream::m_name [private]

Definition at line 408 of file LogStream.hh.

Referenced by getName().

LOG::ELevel slic::LogStream::m_outputLevel [private]

Definition at line 409 of file LogStream.hh.

Referenced by getOutputLevel(), and setOutputLevel().

ostream* slic::LogStream::m_os [private]

Definition at line 410 of file LogStream.hh.

Referenced by getOutputStream(), and setOutputFile().

bool slic::LogStream::m_active [private]

Definition at line 411 of file LogStream.hh.

Referenced by isActive(), and operator<<().

std::ofstream* slic::LogStream::m_fos [private]

Definition at line 412 of file LogStream.hh.

Referenced by setOutputFile().


The documentation for this class was generated from the following file:
Generated on Mon Jun 7 17:46:50 2010 for Simulator for the Linear Collider by  doxygen 1.5.4