- Main Page
- Namespaces
- Classes
- Files

- Class List
- Class Hierarchy
- Class Members

Public Types | Public Member Functions | Static Public Member Functions | List of all members
G::LogOutput Class Reference

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...

## Detailed Description

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.

See also
  G::Log

Definition at line 41 of file glogoutput.h.

## Member Enumeration Documentation

enum G::LogOutput::SyslogFacility

Enumerator
User |
Daemon |
Mail |
Cron |

Definition at line 44 of file glogoutput.h.

## Constructor & Destructor Documentation

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.

G::LogOutput::LogOutput | ( | bool | output_with_logging,
|  | bool | verbose_and_debug = `true`,
|  | const std::string & | stderr_replacement = `std::string()`
| ) |  |
| 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.

G::LogOutput::~LogOutput | ( |  | ) |
| virtual

Destructor.

Definition at line 95 of file glogoutput.cpp.

## Member Function Documentation

void G::LogOutput::assertion | ( | const char * | file,
|  | int | line,
|  | bool | test,
|  | const std::string & | test_string
| ) |  |
| 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.

G::LogOutput * G::LogOutput::instance | ( |  | ) |
| static

Returns a pointer to the controlling LogOutput object.

Returns NULL if none.

Definition at line 108 of file glogoutput.cpp.

void G::LogOutput::onAssert | ( |  | ) |
| 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.

void G::LogOutput::output | ( | G::Log::Severity | severity,
|  | const char * | file,
|  | int | line,
|  | const std::string & | text
| ) |  |
| static

Generates output if there is an existing LogOutput object which is enabled.

Uses rawOutput().

Definition at line 120 of file glogoutput.cpp.

void G::LogOutput::rawOutput | ( | std::ostream & | std_err,
|  | G::Log::Severity | severity,
|  | const std::string & | message
| ) |  |
| 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.

The documentation for this class was generated from the following files:

- glogoutput.h
- glogoutput.cpp
- glogoutput_unix.cpp