FreeRDP-WebConnect WebSockets gateway  1.0.0.167
 All Classes Namespaces Functions Variables Typedefs Enumerations Friends Pages
wsgate::logger Class Reference

A logging class, mapping syslog(3) functionality to C++ on Unix systems. More...

#include <logging.hpp>

List of all members.

Public Types

enum  Facility {
  AUTH,
  AUTHPRIV,
  CRON,
  DAEMON,
  FTP,
  KERN,
  LOCAL0,
  LOCAL1,
  LOCAL2,
  LOCAL3,
  LOCAL4,
  LOCAL5,
  LOCAL6,
  LOCAL7,
  LPR,
  MAIL,
  NEWS,
  SYSLOG,
  USER,
  UUCP
}
 The predefined facilities.

Public Member Functions

 logger (const std::string &ident, const Facility facility=DAEMON, const std::string &mask="11111111")
 Initializes logging.
 logger (const logger &other)
 Copy constructor.
loggeroperator= (const logger &other)
 Assignment operator.
void setmask (std::bitset< 8 >mask)
 Modifies the set of enabled log levels.
void setmaskByName (const std::string &names)
 Modifies the set of enabled log levels.
void setfacility (Facility facility)
 Modifies the log facility.
void setfacilityByName (const std::string &facility)
 Modifies the log facility.

Static Public Member Functions

static void release ()
 Releases the internal log buffers.
static void enable ()
 Enables logging on all existing log channels.
static void disable ()
 Disables logging on all existing log channels.

Static Public Attributes

static std::ostream debug
 Stream for logging with log level LOG_DEBUG.
static std::ostream info
 Stream for logging with log level LOG_INFO.
static std::ostream notice
 Stream for logging with log level LOG_NOTICE.
static std::ostream warn
 Stream for logging with log level LOG_WARNING.
static std::ostream err
 Stream for logging with log level LOG_ERR.
static std::ostream crit
 Stream for logging with log level LOG_CRIT.
static std::ostream alert
 Stream for logging with log level LOG_ALERT.
static std::ostream emerg
 Stream for logging with log level LOG_EMERG.

Detailed Description

A logging class, mapping syslog(3) functionality to C++ on Unix systems.

On Windows systems, the logging is performed via the application event log (all log levels, except LOG_DEBUG) and via OutputDebugString (for log level LOG_DEBUG). For every log level, a corresponding ostream exists.

Definition at line 36 of file logging.hpp.


Constructor & Destructor Documentation

wsgate::logger::logger ( const std::string &  ident,
const Facility  facility = DAEMON,
const std::string &  mask = "11111111" 
)

Initializes logging.

Parameters:
identThe program identifier. On Windows systems, this parameter defines the name of the EventSource in the application log.
Additional note for Windows:
In order to create proper entries in the application event log, a registry key with the supplied name is created below HKLM\SYSTEM\CurrentControlSet\Services\EventLog\Application\ this key is not automatically deleted, since it's content points to the executable (or dll) which is using this class. Therefore, in your uninstaller, please remove that key.
See also:
openlog(3).
Parameters:
facilityThe log facility to use. Ignored on Windows.
See also:
openlog(3).
Parameters:
maskA string, specifying which log levels are enabled. This string can be specified in multiple formats:
  • A std::bitmask initializer of length 8. The leftmost bit is accociated with the LOG_DEBUG level, the next bit with LOG_INFO and so on.
  • A string of log level names (all uppercase). Log level names can be DEBUG, INFO, NOTICE, WARNING, ERR, CRIT, ALERT and EMERG.

Member Function Documentation

void wsgate::logger::setfacility ( Facility  facility)

Modifies the log facility.

This method has no effect on Windows.

Parameters:
facilityThe log facility to use
See also:
openlog(3)
void wsgate::logger::setfacilityByName ( const std::string &  facility)

Modifies the log facility.

This method has no effect on Windows.

Parameters:
facilityA string containg the facility name.
void wsgate::logger::setmask ( std::bitset< 8 >  mask)

Modifies the set of enabled log levels.

Parameters:
maskA std::bitset of length 8. The leftmost bit is accociated with the LOG_DEBUG level, the next bit with LOG_INFO and so on.
void wsgate::logger::setmaskByName ( const std::string &  names)

Modifies the set of enabled log levels.

Parameters:
namesA string of log level names (all uppercase). Log level names can be DEBUG, INFO, NOTICE, WARNING, ERR, CRIT, ALERT and EMERG.

Member Data Documentation

std::ostream wsgate::logger::alert
static

Stream for logging with log level LOG_ALERT.

On Windows, the message is tagged with an Error-Icon in the application event log. Writing to this stream before invokation of the constructor does nothing.

Definition at line 202 of file logging.hpp.

std::ostream wsgate::logger::crit
static

Stream for logging with log level LOG_CRIT.

On Windows, the message is tagged with an Error-Icon in the application event log. Writing to this stream before invokation of the constructor does nothing.

Definition at line 193 of file logging.hpp.

std::ostream wsgate::logger::debug
static

Stream for logging with log level LOG_DEBUG.

Writing to this stream before invokation of the constructor does nothing. On Windows, output is done via OutputDebugString and can be examined by tools like DebugView.

Definition at line 148 of file logging.hpp.

std::ostream wsgate::logger::emerg
static

Stream for logging with log level LOG_EMERG.

Writing to this stream before invokation On Windows, the message is tagged with an Error-Icon in the application event log. of the constructor does nothing.

Definition at line 211 of file logging.hpp.

std::ostream wsgate::logger::err
static

Stream for logging with log level LOG_ERR.

On Windows, the message is tagged with an Error-Icon in the application event log. Writing to this stream before invokation of the constructor does nothing.

Definition at line 184 of file logging.hpp.

std::ostream wsgate::logger::info
static

Stream for logging with log level LOG_INFO.

On Windows, the message is tagged with an Info-Icon in the application event log. Writing to this stream before invokation of the constructor does nothing.

Definition at line 157 of file logging.hpp.

std::ostream wsgate::logger::notice
static

Stream for logging with log level LOG_NOTICE.

On Windows, the message is tagged with an Info-Icon in the application event log. Writing to this stream before invokation of the constructor does nothing.

Definition at line 166 of file logging.hpp.

std::ostream wsgate::logger::warn
static

Stream for logging with log level LOG_WARNING.

On Windows, the message is tagged with a Warning-Icon in the application event log. Writing to this stream before invokation of the constructor does nothing.

Definition at line 175 of file logging.hpp.


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