COOLFluiD
Release kernel
COOLFluiD is a Collaborative Simulation Environment (CSE) focused on complex MultiPhysics simulations.
|
Filters log messages corresponding to their level. More...
#include <LogLevelFilter.hpp>
Public Types | |
typedef char | char_type |
typedef boost::iostreams::multichar_output_filter_tag | category |
Public Member Functions | |
LogLevelFilter (LogLevel level) | |
Constructor. More... | |
void | set_filter (LogLevel level) |
Sets the default log level. More... | |
LogLevel | get_filter () const |
Gives the default log level. More... | |
void | set_tmp_log_level (const Uint level) |
void | set_log_level (const Uint level) |
Sets the current log level. More... | |
Uint | get_log_level () const |
Gives the current log level. More... | |
void | resetToDefaultLevel () |
Resets the current log level to the default level. More... | |
template<typename Sink > | |
std::streamsize | write (Sink &sink, const char_type *data, std::streamsize size) |
Forwards a message. More... | |
Private Attributes | |
LogLevel | m_filter |
The filtering value for the log level. More... | |
Uint | m_log_level |
The default log level. More... | |
Uint | m_tmp_log_level |
A temporary override of the log level. More... | |
Filters log messages corresponding to their level.
This class is written to act as a Boost.Iostreams filter. It defines char_type
and category
types and a write
method for that purpose.
The class is constructed with a filter value. An additional level can be set that gets compared to the filter. If the level is higher or equal to the filter, the message gets forwarded.
A temporary override of the level is possible, using set_tmp_log_level(), which gets restored by calling resetToDefaultLevel()
Example:
If the filter is set to only pass messages of WARNING
, and the level is set to:
DEBUG
, then it is blockedINFO
, then it is blockedWARNING
, then it is forwardedERROR
, then it is forwardedDefinition at line 42 of file LogLevelFilter.hpp.
typedef boost::iostreams::multichar_output_filter_tag category |
Definition at line 47 of file LogLevelFilter.hpp.
typedef char char_type |
Definition at line 46 of file LogLevelFilter.hpp.
LogLevelFilter | ( | LogLevel | level | ) |
LogLevel get_filter | ( | ) | const |
Gives the default log level.
Definition at line 31 of file LogLevelFilter.cpp.
Uint get_log_level | ( | ) | const |
Gives the current log level.
Definition at line 48 of file LogLevelFilter.cpp.
void resetToDefaultLevel | ( | ) |
Resets the current log level to the default level.
Calling this method is equivalent to:
Definition at line 56 of file LogLevelFilter.cpp.
void set_filter | ( | LogLevel | level | ) |
Sets the default log level.
level | The new default level. |
Definition at line 23 of file LogLevelFilter.cpp.
void set_log_level | ( | const Uint | level | ) |
Sets the current log level.
level | The current log level. |
Definition at line 39 of file LogLevelFilter.cpp.
void set_tmp_log_level | ( | const Uint | level | ) |
Definition at line 64 of file LogLevelFilter.cpp.
|
inline |
Forwards a message.
Example:
If the filter is set to only pass messages of WARNING
, and the level is set to:
DEBUG
, then it is blockedINFO
, then it is blockedWARNING
, then it is forwardedERROR
, then it is forwarded sink | The sink to which the message has to be written. |
data | Message data. |
size | Message data size. |
size
. Definition at line 97 of file LogLevelFilter.hpp.
|
private |
The filtering value for the log level.
Definition at line 110 of file LogLevelFilter.hpp.
|
private |
The default log level.
Definition at line 113 of file LogLevelFilter.hpp.
|
private |
A temporary override of the log level.
Definition at line 116 of file LogLevelFilter.hpp.
Send comments to: COOLFluiD Web Admin |