stk::LogControl Class Reference

#include <LogControl.hpp>

List of all members.


Detailed Description

Class LogControl provides a mechanism for reducing excessive output.

The output is redirected to a cache where it can be written to the log stream where and error condition arises.

The controlling of the log stream is handled by creating a sentry which controls the stream buffer of the specified stream using the specified rule. The next() function executes the rule and redirects the output to the log stream when the rule is true and to the cache when the rule is false.

LogControl sentries can be nested. When nested, the current rule is if the parent is caching, then child is forced to cache. This behavior could change by passing parent state to next().

It's important to note that LogControl sentries nearly always shared the same output stream. So the parent's original output stream buffer

Definition at line 202 of file LogControl.hpp.

Public Member Functions

 LogControl (std::ostream &log_stream, const LogControlRule &rule)
 Creates a new LogControl instance.
 LogControl (std::ostream &log_stream, const std::string &rule_name)
 Creates a new LogControl instance.
 ~LogControl ()
 Destroys a LogControl instance.
void next ()
 Member function next executes the rule and sets the log stream to write to the log file if true and to the cache if false.
void fail ()
 Member function fail writes the cached output to the log stream due to an error.


Constructor & Destructor Documentation

stk::LogControl::LogControl ( std::ostream &  log_stream,
const LogControlRule rule 
)

Creates a new LogControl instance.

Parameters:
log_stream a std::ostream reference to the log stream to control.
rule a LogControlRule reference to the rule used to control the log stream.

Definition at line 56 of file LogControl.cpp.

stk::LogControl::LogControl ( std::ostream &  log_stream,
const std::string &  rule_name 
)

Creates a new LogControl instance.

Parameters:
log_stream a std::ostream reference to the log stream to control.
rule_name a std::string constant reference to rule name used to control the log stream.


The documentation for this class was generated from the following files:
Generated on Tue Jul 13 09:27:33 2010 for Sierra Toolkit by  doxygen 1.4.7