slic::LogStream Class Reference

#include <LogStream.hh>

Collaboration diagram for slic::LogStream:

Collaboration graph
slic::LogMessenger
[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 62 of file LogStream.hh.


Public Member Functions

 LogStream (const std::string &name, LOG::ELevel level, ostream *os=&std::cout)
 LogStream ()
virtual ~LogStream ()
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)

Private Attributes

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

Constructor & Destructor Documentation

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

Definition at line 67 of file LogStream.hh.

References m_messenger.

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

Definition at line 80 of file LogStream.hh.

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

Definition at line 90 of file LogStream.hh.


Member Function Documentation

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

Definition at line 96 of file LogStream.hh.

References m_name.

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

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

Definition at line 101 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 106 of file LogStream.hh.

References m_outputLevel.

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

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

Definition at line 111 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 116 of file LogStream.hh.

References m_outputLevel.

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

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

Stream the level of this message.

Definition at line 124 of file LogStream.hh.

References getOutputLevel(), m_active, and m_outputLevel.

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

Definition at line 143 of file LogStream.hh.

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

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

Definition at line 163 of file LogStream.hh.

References getOutputStream(), and isActive().

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

Definition at line 171 of file LogStream.hh.

References getOutputStream(), and isActive().

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

Definition at line 179 of file LogStream.hh.

References getOutputStream(), and isActive().

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

Definition at line 187 of file LogStream.hh.

References getOutputStream(), and isActive().

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

Definition at line 195 of file LogStream.hh.

References getOutputStream(), and isActive().

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

Definition at line 204 of file LogStream.hh.

References getOutputStream(), and isActive().

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

Definition at line 213 of file LogStream.hh.

References getOutputStream(), and isActive().

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

Definition at line 223 of file LogStream.hh.

References getOutputStream(), and isActive().

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

Definition at line 233 of file LogStream.hh.

References getOutputStream(), and isActive().

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

Definition at line 242 of file LogStream.hh.

References getOutputStream(), and isActive().

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

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

Definition at line 247 of file LogStream.hh.

References getOutputStream(), and isActive().

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

Definition at line 253 of file LogStream.hh.

References getOutputStream(), and isActive().

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

Definition at line 258 of file LogStream.hh.

References getOutputStream(), and isActive().

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

Definition at line 263 of file LogStream.hh.

References getOutputStream(), and isActive().

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

Definition at line 268 of file LogStream.hh.

References getOutputStream(), and isActive().

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

Definition at line 273 of file LogStream.hh.

References getOutputStream(), and isActive().

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

Definition at line 278 of file LogStream.hh.

References getOutputStream(), and isActive().

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

Definition at line 283 of file LogStream.hh.

References getOutputStream(), and isActive().

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

Definition at line 288 of file LogStream.hh.

References getOutputStream(), and isActive().

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

Definition at line 293 of file LogStream.hh.

References getOutputStream(), and isActive().

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

Definition at line 298 of file LogStream.hh.

References getOutputStream(), and isActive().

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

Definition at line 303 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 308 of file LogStream.hh.

References getOutputStream(), and isActive().

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

Definition at line 313 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 320 of file LogStream.hh.

References getOutputStream(), and isActive().

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

Definition at line 328 of file LogStream.hh.

References m_fos, and m_os.

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

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

Definition at line 335 of file LogStream.hh.

References LOG::debug.

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

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

Definition at line 340 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 345 of file LogStream.hh.

References LOG::okay.

Referenced by slic::PhysicsListFactory::create(), slic::SlicApplication::initialize(), slic::PhysicsListManager::initializePhysicsList(), slic::LcioManager::makeAutoname(), slic::LcioManager::openLcioFile(), slic::StdHepLoader::openStdHepFile(), slic::PhysicsListManager::setCurrentListName(), slic::LcioManager::setDetectorName(), and slic::EventSourceManager::setupEventSource().

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

Definition at line 350 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 355 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 360 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 365 of file LogStream.hh.

References LOG::always.

Referenced by slic::SlicApplication::initialize().

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

Definition at line 370 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 375 of file LogStream.hh.

References getOutputLevel(), and log().

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

Definition at line 380 of file LogStream.hh.

References LOG::debug, and log().

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

Definition at line 385 of file LogStream.hh.

References log(), and LOG::verbose.

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

Definition at line 390 of file LogStream.hh.

References log(), and LOG::okay.

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

Definition at line 395 of file LogStream.hh.

References log(), and LOG::warning.

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

Definition at line 400 of file LogStream.hh.

References LOG::error, and log().

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

Definition at line 405 of file LogStream.hh.

References LOG::fatal, and log().

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

Definition at line 410 of file LogStream.hh.

References LOG::always, and log().


Member Data Documentation

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

Definition at line 416 of file LogStream.hh.

Referenced by getName().

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

Definition at line 417 of file LogStream.hh.

Referenced by getOutputLevel(), operator<<(), and setOutputLevel().

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

Definition at line 418 of file LogStream.hh.

Referenced by getOutputStream(), and setOutputFile().

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

Definition at line 419 of file LogStream.hh.

Referenced by operator<<().

bool slic::LogStream::m_active [private]

Definition at line 420 of file LogStream.hh.

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

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

Definition at line 421 of file LogStream.hh.

Referenced by setOutputFile().

LogMessenger* slic::LogStream::m_messenger [private]

Definition at line 422 of file LogStream.hh.

Referenced by LogStream().


The documentation for this class was generated from the following file:
Generated on Thu Nov 15 15:24:42 2007 for Simulator for the Linear Collider by  doxygen 1.5.4