G::LogOutput Class Reference

Controls and implements low-level logging output, as used by the Log interface. More...

#include <glogoutput.h>

List of all members.

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, SyslogFacility syslog_facility=User)
 Constructor.
 LogOutput (bool output_with_logging, bool verbose_and_debug=true)
 Constructor for test programs.
virtual ~LogOutput ()
 Destructor.
virtual void rawOutput (G::Log::Severity, const std::string &)
 Overridable.
bool enable (bool enabled=true)
 Enables or disables output. Returns the previous setting.
virtual void onAssert ()
 Called during an assertion failure.

Static Public Member Functions

static LogOutputinstance ()
 Returns a pointer to the controlling LogOutput object.
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.
static void assertion (const char *file, int line, bool test, const std::string &)
 Makes an assertion check (regardless of any LogOutput object).


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 40 of file glogoutput.h.


Member Enumeration Documentation

Enumerator:
User 
Daemon 
Mail 
Cron 

Definition at line 43 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,
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 30 of file glogoutput.cpp.

G::LogOutput::LogOutput ( bool  output_with_logging,
bool  verbose_and_debug = true 
) [explicit]

Constructor for test programs.

Only generates output if the first parameter is true. Never uses syslog.

Definition at line 52 of file glogoutput.cpp.

G::LogOutput::~LogOutput (  )  [virtual]

Destructor.

Definition at line 71 of file glogoutput.cpp.


Member Function Documentation

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

G::LogOutput * G::LogOutput::instance (  )  [static]

Returns a pointer to the controlling LogOutput object.

Returns NULL if none.

Definition at line 84 of file glogoutput.cpp.

Referenced by assertion(), and output().

bool G::LogOutput::enable ( bool  enabled = true  ) 

Enables or disables output. Returns the previous setting.

Definition at line 89 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 96 of file glogoutput.cpp.

References doOutput(), and instance().

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 203 of file glogoutput.cpp.

References doAssertion(), and instance().

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 167 of file glogoutput.cpp.


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

Generated on Fri Apr 18 15:56:13 2008 for E-MailRelay by  doxygen 1.5.5