OSB_LIB::Log Class Reference

Collaboration diagram for OSB_LIB::Log:

Collaboration graph
[legend]
List of all members.

Detailed Description

Singleton client to logging interface.

This is logging interface for the library. It is purely static, i.e., a singleton class.

Definition at line 304 of file osblog.h.

Static Public Member Functions

Client interface.
Application interface.

Private Member Functions

Static Private Member Functions

Static Private Attributes


Constructor & Destructor Documentation

OSB_LIB::Log::Log (  )  [private]

Prevent construction: not implemented.


Member Function Documentation

LogBase & OSB_LIB::Log::cont (  )  [inline, static]

Continue a log message.

This is typically used when logging must be done over loop or when a conditional is involved:

          Log::info() << "Version information" << Log::nl;
          for (int i = 0; i < vsinfo.size(); ++i) {
              Log::cont()     << "File:    " << vsinfo[i].file_
                              << Log::nl;
              if (!vsinfo[i].name_.empty()) {
                  Log::cont() << "Name:    " << vsinfo[i].name_
                              << Log::nl;
              }
              Log::cont()     << "Version: " << vsinfo[i].version_
                              << Log::nl;
          }
          Log::endlog();

Definition at line 538 of file osblog.h.

References instance().

Referenced by empty().

LogBase & OSB_LIB::Log::debug ( int  level = 1  )  [inline, static]

Start a debugging message.

Parameters:
level See LogBase::debug for a description.

Definition at line 533 of file osblog.h.

References OSB_LIB::LogBase::debug(), and instance().

void OSB_LIB::Log::elog ( LogBase log  )  [inline, static]

Manipulator: end a log message with a new-line.

Definition at line 562 of file osblog.h.

References OSB_LIB::LogBase::elog().

void OSB_LIB::Log::empty ( int  level,
int  lines = 1 
) [inline, static]

Convenience function: write empty lines.

Definition at line 548 of file osblog.h.

References cont(), endlog(), and raw().

void OSB_LIB::Log::endlog ( LogBase log  )  [inline, static]

Manipulator: end a log message without a new-line.

Definition at line 567 of file osblog.h.

References OSB_LIB::LogBase::endlog().

void OSB_LIB::Log::endlog (  )  [inline, static]

Terminate a log message without a new-line.

See cont() for an example.

Definition at line 543 of file osblog.h.

References OSB_LIB::LogBase::endlog(), and instance().

Referenced by empty().

LogBase & OSB_LIB::Log::error (  )  [inline, static]

Start an error message.

Definition at line 513 of file osblog.h.

References OSB_LIB::LogBase::error(), and instance().

LogBase & OSB_LIB::Log::fatal (  )  [inline, static]

Start a fatal error message.

Definition at line 508 of file osblog.h.

References OSB_LIB::LogBase::fatal(), and instance().

const LogBase::HeadFiller OSB_LIB::Log::head ( char  filler = ' '  )  [inline, static]

Manipulator: fill head of line with a character.

This is useful for underlining:

          Log::info() << "Version info:\n"
                      << Log::head('=')
                      << "=============" << Log::elog;

Definition at line 572 of file osblog.h.

References OSB_LIB::LogBase::HeadFiller::filler_.

LogBase & OSB_LIB::Log::info (  )  [inline, static]

Start a normal message.

Definition at line 523 of file osblog.h.

References OSB_LIB::LogBase::info(), and instance().

static LogBase& OSB_LIB::Log::instance (  )  [static, private]

Get the logging instance.

Returns:
*instance_ if not 0, else an instance of ConsoleLog.

Referenced by cont(), debug(), endlog(), error(), fatal(), info(), logLevel(), raw(), setLevel(), setVerbose(), verbose(), and warn().

int OSB_LIB::Log::logLevel (  )  [inline, static]

Get the current log level.

Definition at line 579 of file osblog.h.

References instance(), and OSB_LIB::LogBase::logLevel().

LogBase & OSB_LIB::Log::nl ( LogBase log  )  [inline, static]

Manipulator: start a new line.

Definition at line 557 of file osblog.h.

References OSB_LIB::LogBase::nl().

LogBase & OSB_LIB::Log::raw ( int  level = 4  )  [inline, static]

Start a message without standard header.

Parameters:
level Logging level of the message:
1: fatal
2: error
3: warn
4: info
5+: debug

Definition at line 528 of file osblog.h.

References instance(), and OSB_LIB::LogBase::raw().

Referenced by empty().

static LogBase* OSB_LIB::Log::setInstance ( std::auto_ptr< LogBase instance  )  [static]

Set the logging class, taking ownership.

Parameters:
instance Auto-pointer to an object of the logging implementation.
Returns:
Previous value of instance_ if the application owns the logging instance, else 0.

static LogBase* OSB_LIB::Log::setInstance ( LogBase instance  )  [static]

Set the logging class.

Parameters:
instance Pointer to an object of the logging implementation.
Returns:
Previous value of instance_ if the application owns the logging instance, else 0.

void OSB_LIB::Log::setLevel ( int  logLevel  )  [inline, static]

Set the log level.

Parameters:
logLevel New log level to be used.

Definition at line 584 of file osblog.h.

References instance(), and OSB_LIB::LogBase::setLevel().

void OSB_LIB::Log::setVerbose ( bool  on  )  [inline, static]

Set verbose flag.

Definition at line 594 of file osblog.h.

References instance(), and OSB_LIB::LogBase::setVerbose().

bool OSB_LIB::Log::verbose (  )  [inline, static]

Verbose (duplicate) messages on slog()?

Definition at line 589 of file osblog.h.

References instance(), and OSB_LIB::LogBase::verbose().

LogBase & OSB_LIB::Log::warn (  )  [inline, static]

Start an warning.

Definition at line 518 of file osblog.h.

References instance(), and OSB_LIB::LogBase::warn().


Member Data Documentation

LogBase* OSB_LIB::Log::instance_ [static, private]

Pointer to logging implementation.

Definition at line 432 of file osblog.h.

bool OSB_LIB::Log::ownsInstance_ [static, private]

Flag if instance_ is owned by this singleton class.

Definition at line 434 of file osblog.h.


The documentation for this class was generated from the following file:
Generated on Sat Sep 2 14:12:15 2006 for OSB Library by  doxygen 1.4.7