ScopedLog Class Reference
[Scoped]

#include <ScopedLog.h>

List of all members.


Detailed Description

handles printing a log message in the constructor and destructor

Contains options for prefix and postfix, log and annotate, to support when and where to print. It also supports a log level, note to print for Pip, and selector id to print to.

Common usage:

 void fn() {
   static const log_id_t lid = Log::getId("global::fn");
   ScopedLog sl("function fn", 0, lid, true, true, true, false);
   // do some work.
 }
Which causes "STARTING/ENDING "function fn" messages to be printed at the beginning and ending of the fn function, to the log class using lid "global::fn", and not using Pip annotations.

Todo:
place in the mace namespace.

Definition at line 73 of file ScopedLog.h.


Public Member Functions

 ScopedLog (const std::string &_note, log_level_t _level, log_id_t _logId, bool _prefix, bool _suffix, bool _log, bool _annotate)
 constructs a new scoped log obejct

Constructor & Destructor Documentation

ScopedLog::ScopedLog ( const std::string &  _note,
log_level_t  _level,
log_id_t  _logId,
bool  _prefix,
bool  _suffix,
bool  _log,
bool  _annotate 
) [inline]

constructs a new scoped log obejct

Parameters:
_note A Pip-only description of what starting and endings are being logged
_level The log level to pass to the log class
_logId The log selector id to use for logging
_prefix Whether to log in the constructor
_suffix Whether to log in the destructor
_log Whether to log to the log class
_annotate Whether to use Pip annotations

Definition at line 85 of file ScopedLog.h.

References ANNOTATE_GET_PATH_ID(), ANNOTATE_NOTICE(), ANNOTATE_PUSH_PATH_ID(), ANNOTATE_START_TASK(), Log::binaryLog(), Log::endl, Log::getId(), and Log::log().


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

Generated on Sat Oct 4 21:30:30 2008 for Mace Library by  doxygen 1.5.5