![]() |
Vault
4.1
|
VLoggerRepetitionFilter provides VLogger a simple way of preventing runaway repetitive log output. More...
#include <vlogger.h>
Public Member Functions | |
void | setEnabled (bool enabled) |
Some VLogger subclasses may want to simply disable filtering. | |
bool | isEnabled () const |
Returns true if the filter is enabled. | |
void | reset () |
Clears any pending message so that the filter is back to an initial state. | |
bool | checkMessage (VNamedLogger &logger, int level, const char *file, int line, const VString &message, const VString &specifiedLoggerName, const VString &actualLoggerName) |
Checks the proposed log message; may save it or increment the internal counter; may emit a pending saved message; returns true if the caller should proceed to emit the message normally. | |
void | checkTimeout (VNamedLogger &logger) |
Checks to see if a long time has elapsed since the pending repeat has been sitting here. |
VLoggerRepetitionFilter provides VLogger a simple way of preventing runaway repetitive log output.
If the same text is emitted at the same level multiple times in succession, only the first and last occurrences are emitted (the last one is adorned with an indication of how many occurrences were suppressed, if any).
void VLoggerRepetitionFilter::setEnabled | ( | bool | enabled | ) | [inline] |
bool VLoggerRepetitionFilter::isEnabled | ( | ) | const [inline] |
void VLoggerRepetitionFilter::reset | ( | ) |
Clears any pending message so that the filter is back to an initial state.
This does not change the enabled state.
Definition at line 1293 of file vlogger.cpp.
References VString::EMPTY(), VInstant::NEVER_OCCURRED(), and NULL.
bool VLoggerRepetitionFilter::checkMessage | ( | VNamedLogger & | logger, |
int | level, | ||
const char * | file, | ||
int | line, | ||
const VString & | message, | ||
const VString & | specifiedLoggerName, | ||
const VString & | actualLoggerName | ||
) |
Checks the proposed log message; may save it or increment the internal counter; may emit a pending saved message; returns true if the caller should proceed to emit the message normally.
logger | the logger to which any backlog of messages will be emitted |
level | the level of detail of the message |
file | the file name that is emitting the log message; NULL will suppress file and line in output |
line | the line number that is emitting the log message |
message | the text to emit |
specifiedLoggerName | if not empty, the logger name supplied by original caller |
actualLoggerName | if not empty, the logger name that is actually calling us |
Definition at line 1305 of file vlogger.cpp.
References VInstant::setNow().
void VLoggerRepetitionFilter::checkTimeout | ( | VNamedLogger & | logger | ) |
Checks to see if a long time has elapsed since the pending repeat has been sitting here.
This is called by the logger before checking the log level. This prevents the case where a repeat never gets output just because there's nothing after it that fits the log level.
logger | the logger to which any backlog of messages will be emitted |
Definition at line 1347 of file vlogger.cpp.
References VDuration::MINUTE().