Sierra Toolkit Version of the Day
stk::LogControl Class Reference

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. More...

#include <LogControl.hpp>

Collaboration diagram for stk::LogControl:

List of all members.

Public Member Functions

 LogControl (std::ostream &log_stream, const LogControlRule &rule)
 LogControl (std::ostream &log_stream, const std::string &rule_name)
 ~LogControl ()
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.

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.


Constructor & Destructor Documentation

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

Creates a new LogControl instance.

Parameters:
log_streama std::ostream reference to the log stream to control.
rulea 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_streama std::ostream reference to the log stream to control.
rule_namea std::string constant reference to rule name used to control the log stream.
stk::LogControl::~LogControl ( )

Destroys a LogControl instance.

Definition at line 96 of file LogControl.cpp.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends