Sierra Toolkit
Version of the Day
|
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>
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. | |
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.
stk_classic::LogControl::LogControl | ( | std::ostream & | log_stream, |
const LogControlRule & | rule | ||
) |
Creates a new LogControl
instance.
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_classic::LogControl::LogControl | ( | std::ostream & | log_stream, |
const std::string & | rule_name | ||
) |
Creates a new LogControl
instance.
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. |
stk_classic::LogControl::~LogControl | ( | ) |
Destroys a LogControl
instance.
Definition at line 96 of file LogControl.cpp.