Controls and implements low-level logging output, as used by the Log interface. More...
#include <glogoutput.h>
Public Types | |
enum | SyslogFacility { User, Daemon, Mail, Cron } |
Public Member Functions | |
LogOutput (const std::string &prefix, bool output, bool with_logging, bool with_verbose_logging, bool with_debug, bool with_level, bool with_timestamp, bool strip_context, bool use_syslog, const std::string &stderr_replacement=std::string(), SyslogFacility syslog_facility=User) | |
Constructor. More... | |
LogOutput (bool output_with_logging, bool verbose_and_debug=true, const std::string &stderr_replacement=std::string()) | |
Constructor for test programs. More... | |
virtual | ~LogOutput () |
Destructor. More... | |
virtual void | rawOutput (std::ostream &, G::Log::Severity, const std::string &) |
Overridable. More... | |
bool | enable (bool enabled=true) |
Enables or disables output. Returns the previous setting. More... | |
virtual void | onAssert () |
Called during an assertion failure. More... | |
Static Public Member Functions | |
static LogOutput * | instance () |
Returns a pointer to the controlling LogOutput object. More... | |
static void | output (G::Log::Severity, const char *file, int line, const std::string &) |
Generates output if there is an existing LogOutput object which is enabled. More... | |
static void | assertion (const char *file, int line, bool test, const std::string &) |
Makes an assertion check (regardless of any LogOutput object). More... | |
Controls and implements low-level logging output, as used by the Log interface.
Applications should instantiate a LogOutput object in main() to enable log output.
Definition at line 41 of file glogoutput.h.
Enumerator | |
---|---|
User | |
Daemon | |
Cron |
Definition at line 44 of file glogoutput.h.
G::LogOutput::LogOutput | ( | const std::string & | prefix, |
bool | output, | ||
bool | with_logging, | ||
bool | with_verbose_logging, | ||
bool | with_debug, | ||
bool | with_level, | ||
bool | with_timestamp, | ||
bool | strip_context, | ||
bool | use_syslog, | ||
const std::string & | stderr_replacement = std::string() , |
||
SyslogFacility | syslog_facility = User |
||
) |
Constructor.
If there is no LogOutput object, or if 'output' is false, then there is no output of any sort. Otherwise at least warning and error messages are generated.
If 'with-logging' is true then log[summary] messages are output. If 'with-verbose-logging' is true then log[verbose] messages are output. If 'with_debug' is true then debug messages will also be generated (but only if compiled in).
More than one LogOutput object may be created, but only the first one controls output.
Definition at line 32 of file glogoutput.cpp.
|
explicit |
Constructor for test programs.
Only generates output if the first parameter is true. Never uses syslog.
Definition at line 55 of file glogoutput.cpp.
|
virtual |
Destructor.
Definition at line 95 of file glogoutput.cpp.
|
static |
Makes an assertion check (regardless of any LogOutput object).
Calls output() if the 'file' parameter is not null.
Definition at line 230 of file glogoutput.cpp.
bool G::LogOutput::enable | ( | bool | enabled = true | ) |
Enables or disables output. Returns the previous setting.
Definition at line 113 of file glogoutput.cpp.
|
static |
Returns a pointer to the controlling LogOutput object.
Returns NULL if none.
Definition at line 108 of file glogoutput.cpp.
|
virtual |
Called during an assertion failure.
This allows Windows applications to stop timers etc. (Timers can cause reentrancy problems and infinitely recursive dialog box creation.)
Definition at line 181 of file glogoutput.cpp.
|
static |
Generates output if there is an existing LogOutput object which is enabled.
Uses rawOutput().
Definition at line 120 of file glogoutput.cpp.
|
virtual |
Overridable.
Used to do the final message output (with OutputDebugString() or stderr).
Definition at line 51 of file glogoutput_unix.cpp.
References G::Log::s_Debug.