SNMP++  3.3.4
DefaultLog Class Reference

The DefaultLog class has a static Log member, that is used by the AGENT++ API for logging. More...

#include <log.h>

Collaboration diagram for DefaultLog:

Public Member Functions

 DefaultLog ()
 
 ~DefaultLog ()
 

Static Public Member Functions

static void init (AgentLog *logger)
 Initialize the default logger with the given logging implementation. More...
 
static AgentLoginit_ts (AgentLog *logger=NULL)
 Initialize the default logger with the given logging implementation if there is currently no logger instance set. More...
 
static void cleanup ()
 Free the logging implementation. More...
 
static AgentLoglog ()
 Return the default logger. More...
 
static void create_log_entry (const char *name, unsigned char t)
 Create a new log entry or reuse an existing one. More...
 
static LogEntrylog_entry ()
 Return the current log entry. More...
 
static void delete_log_entry ()
 Delete current log entry. More...
 
static void lock ()
 Lock the log singleton. More...
 
static void unlock ()
 Unlock the log singleton. More...
 

Static Protected Attributes

static AgentLoginstance
 
static LogEntryentry
 
static SnmpSynchronized mutex
 
static const char defaultName
 

Detailed Description

The DefaultLog class has a static Log member, that is used by the AGENT++ API for logging.

Version
3.6
Author
Frank Fock (singleton pattern -> Philippe Roger)

Definition at line 484 of file log.h.

Constructor & Destructor Documentation

DefaultLog::DefaultLog ( )
inline

Definition at line 486 of file log.h.

DefaultLog::~DefaultLog ( )
inline

Definition at line 487 of file log.h.

Member Function Documentation

static void DefaultLog::cleanup ( )
static

Free the logging implementation.

Note
This method is THREADSAFE.
static void DefaultLog::create_log_entry ( const char *  name,
unsigned char  t 
)
inlinestatic

Create a new log entry or reuse an existing one.

Parameters
typethe type of the log entry as bitwise or of log class and level.

Definition at line 548 of file log.h.

static void DefaultLog::delete_log_entry ( )
inlinestatic

Delete current log entry.

Definition at line 575 of file log.h.

static void DefaultLog::init ( AgentLog logger)
inlinestatic

Initialize the default logger with the given logging implementation.

Note
Call cleanup function before the application exits
The DefaultLog class takes ownership of the pointer. Do not delete it yourself.
This method is NOT THREADSAFE. It must be called in main() before any logging takes place.
Parameters
loggeran AgentLog instance to be used as default logger. A previously set logger will be deleted.

Definition at line 502 of file log.h.

static AgentLog* DefaultLog::init_ts ( AgentLog logger = NULL)
static

Initialize the default logger with the given logging implementation if there is currently no logger instance set.

Note
Call cleanup function before the application exits
The DefaultLog class takes ownership of the pointer. Do not delete it yourself.
This method is THREADSAFE.
Parameters
loggeran AgentLog instance to be used as default logger.
Returns
the existing logger (if there was any) or the new logger pointer.
Since
3.5.24
static void DefaultLog::lock ( )
inlinestatic

Lock the log singleton.

Definition at line 585 of file log.h.

static AgentLog* DefaultLog::log ( )
inlinestatic

Return the default logger.

Returns
a pointer to an AgentLog instance.

Definition at line 534 of file log.h.

static LogEntry* DefaultLog::log_entry ( )
inlinestatic

Return the current log entry.

If there is none, an ERROR_LOG entry with level 1 will be created.

Returns
a pointer to a LogEntry instance.

Definition at line 564 of file log.h.

References ERROR_LOG.

static void DefaultLog::unlock ( )
inlinestatic

Unlock the log singleton.

Definition at line 595 of file log.h.

Member Data Documentation

const char DefaultLog::defaultName
staticprotected

Definition at line 609 of file log.h.

LogEntry* DefaultLog::entry
staticprotected

Definition at line 605 of file log.h.

AgentLog* DefaultLog::instance
staticprotected

Definition at line 604 of file log.h.

SnmpSynchronized DefaultLog::mutex
staticprotected

Definition at line 607 of file log.h.


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