Ion
|
A NullLogEntryWriter can be used completely disable all logging programmatically as long as it exists. More...
#include "nulllogentrywriter.h"
Public Member Functions | |
NullLogEntryWriter () | |
~NullLogEntryWriter () override | |
void | Write (port::LogSeverity severity, const std::string &message) override |
LogEntryWriter impl. More... | |
Protected Member Functions | |
const char * | GetSeverityName (LogSeverity severity) const |
Convenient way to map a severity-code to a printable represenation. More... | |
A NullLogEntryWriter can be used completely disable all logging programmatically as long as it exists.
In this way it is similar to a LogChecker, but does not actually send log messages anywhere. Note that this does NOT prevent FATAL, DFATAL, or DCHECKs from calling the currently installed break handler.
You can disable logging for a scope like this: { NullLogEntryWriter null_logger; ... ///< Very verbose code. } // Old writer is restored when the null logger passes out of scope.
Alternatively, managing the life of the instance can disable logging for longer periods, for example: #if ION_PRODUCTION std::unique_ptr<NullLogEntryWriter> null_logger(new NullLogEntryWriter); #endif could be used to completely disable logging in an application when building for production mode.
Definition at line 49 of file nulllogentrywriter.h.
|
inline |
Definition at line 51 of file nulllogentrywriter.h.
References ion::base::SetLogEntryWriter().
|
inlineoverride |
Definition at line 54 of file nulllogentrywriter.h.
References ion::base::SetLogEntryWriter().
|
protectedinherited |
Convenient way to map a severity-code to a printable represenation.
Maps a Severity code to a name for printing.
Definition at line 24 of file logging.cc.
References ion::port::DFATAL, ion::port::ERROR, ion::port::FATAL, ion::port::INFO, and ion::port::WARNING.
Referenced by ion::base::LogChecker::Write().
|
inlineoverridevirtual |
LogEntryWriter impl.
Implements ion::port::LogEntryWriter.
Definition at line 60 of file nulllogentrywriter.h.