SNMP++  3.3.4
AgentLog Class Referenceabstract

The AgentLog class is an abstract base class representing a log for information that is generated during the run time of an AGENT++ SNMP agent. More...

#include <log.h>

Inheritance diagram for AgentLog:

Public Member Functions

 AgentLog ()
 Default constructor. More...
 
virtual ~AgentLog ()
 Virtual destructor. More...
 
virtual void set_filter (int logclass, unsigned char filter)
 Set a filter on a specified log class. More...
 
virtual unsigned char get_filter (int logclass) const
 Gets the log level for the given log class. More...
 
virtual LogEntrycreate_log_entry (const char *const name, unsigned char t) const =0
 Create a new LogEntry. More...
 
virtual AgentLogoperator+= (const LogEntry *)=0
 Add a LogEntry to the receiver Log. More...
 
virtual bool log_needed (const char *const, unsigned char t) const
 Check whether a logging for the given type of LogEntry has to be done or not. More...
 
virtual const char * now (char *=0)
 Return the current time as a string. More...
 

Static Public Member Functions

static const char * get_current_time ()
 Return the current time as a string, using the current default log object. More...
 

Protected Attributes

unsigned char logfilter [LOG_TYPES]
 
char static_buf [18]
 

Detailed Description

The AgentLog class is an abstract base class representing a log for information that is generated during the run time of an AGENT++ SNMP agent.

A derived class only needs to provide appropriate create_log_entry() and operator+= methods.

See Also
LogEntry
Author
Frank Fock
Version
3.6

Definition at line 301 of file log.h.

Constructor & Destructor Documentation

AgentLog::AgentLog ( )

Default constructor.

virtual AgentLog::~AgentLog ( )
inlinevirtual

Virtual destructor.

Definition at line 311 of file log.h.

Member Function Documentation

virtual LogEntry* AgentLog::create_log_entry ( const char *const  name,
unsigned char  t 
) const
pure virtual

Create a new LogEntry.

Parameters
name- The name of the logging module
t- The type of the log entry.
Returns
A new instance of LogEntry (or of a derived class).

Implemented in AgentLogImpl.

static const char* AgentLog::get_current_time ( )
static

Return the current time as a string, using the current default log object.

(For backward compatibility.)

Note
that the user is responsible for deleting the returned string, using delete [].
Returns
a string containg the current time.
virtual unsigned char AgentLog::get_filter ( int  logclass) const
virtual

Gets the log level for the given log class.

Returns
a unsigned char value between 0 and 15
virtual bool AgentLog::log_needed ( const char *  const,
unsigned char  t 
) const
inlinevirtual

Check whether a logging for the given type of LogEntry has to be done or not.

Parameters
typethe type of the log entry. The type is composed by logical or the log entry class with a level of 0 up to 15.
Returns
TRUE if logging is needed, FALSE otherwise.

Definition at line 370 of file log.h.

References LOG_LEVEL_MASK.

virtual const char* AgentLog::now ( char *  = 0)
virtual

Return the current time as a string.

Parameters
abuffer (of at least 18 characters, for the default method) into which to place a string containg the current time. If no buffer is supplied, a static area is used.
Returns
a string containing the current time. Either the supplied buffer or the static area.
virtual AgentLog& AgentLog::operator+= ( const LogEntry )
pure virtual

Add a LogEntry to the receiver Log.

Parameters
log- A log entry.
Returns
The receiver log itself.

Implemented in AgentLogImpl.

virtual void AgentLog::set_filter ( int  logclass,
unsigned char  filter 
)
virtual

Set a filter on a specified log class.

Only log entries with a level less or equal than the specified level will be logged.

Parameters
logclass- A log entry class.
See Also
LogEntry
Parameters
filter- A value between 0 and 15.

Member Data Documentation

unsigned char AgentLog::logfilter[LOG_TYPES]
protected

Definition at line 398 of file log.h.

char AgentLog::static_buf[18]
protected

Definition at line 399 of file log.h.


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