SNMP++  3.3.4
LogEntry Class Referenceabstract

The LogEntry class represents log entries. More...

#include <log.h>

Inheritance diagram for LogEntry:

Public Member Functions

 LogEntry (const char *const n, unsigned char t)
 Constructor with log class and severity level. More...
 
virtual ~LogEntry ()
 Virtual destructor. More...
 
virtual void init (void)
 Initialize a new log entry, showing timestamp, class, and level. More...
 
virtual LogEntryoperator+= (const long)
 Add a numeric value to the log entry. More...
 
virtual LogEntryoperator+= (const char *)
 Add a string value to the log entry. More...
 
virtual const char * get_value (void) const
 Get the contents of this log entry. More...
 
unsigned char get_type () const
 Get the type of this log entry. More...
 
unsigned char get_class () const
 Get the class of this log entry. More...
 
unsigned char get_level () const
 Get the level of this log entry. More...
 
const char * get_name () const
 Get the logger name of this log entry. More...
 

Protected Member Functions

virtual bool add_string (const char *)=0
 Add a string to the log. More...
 
virtual bool add_integer (long)
 Add an integer to the log. More...
 
virtual bool add_timestamp (void)
 Add the current time to the log. More...
 

Protected Attributes

const char *const name
 
unsigned char type
 
int count
 

Detailed Description

The LogEntry class represents log entries.

An instance of LogEntry can be added to a Log. Each LogEntry can be classified into the log classes ERROR_LOG, WARNING_LOG, EVENT_LOG, INFO_LOG, DEBUG_LOG and USER_LOG with up to 16 severity levels. A log entry consists of a descriptor string and optional several string or numeric values.

The log class USER_LOG can be used for applications, it is not used within snmp++ and agent++.

Note
A error log of level 0 will stop program execution!
See Also
Log
Author
Frank Fock
Marty Janzen
Version
3.6

Definition at line 111 of file log.h.

Constructor & Destructor Documentation

LogEntry::LogEntry ( const char *const  n,
unsigned char  t 
)
inline

Constructor with log class and severity level.

Parameters
n- The name of the logging module
t- The type of the log entry. The type is composed by a logical OR of the log entry class with a level of 0 up to 15.
Note
A error log of level 0 will stop program execution!

Definition at line 122 of file log.h.

virtual LogEntry::~LogEntry ( )
inlinevirtual

Virtual destructor.

Definition at line 127 of file log.h.

Member Function Documentation

virtual bool LogEntry::add_integer ( long  )
protectedvirtual

Add an integer to the log.

Parameters
s- An integer value.
Returns
TRUE if the value has been added and FALSE if the log entry is full.
virtual bool LogEntry::add_string ( const char *  )
protectedpure virtual

Add a string to the log.

Parameters
s- A string value.
Returns
TRUE if the value has been added and FALSE if the log entry is full.

Implemented in LogEntryImpl.

virtual bool LogEntry::add_timestamp ( void  )
protectedvirtual

Add the current time to the log.

unsigned char LogEntry::get_class ( ) const
inline

Get the class of this log entry.

Returns
Log entry class.

Definition at line 168 of file log.h.

References LOG_CLASS_MASK.

unsigned char LogEntry::get_level ( ) const
inline

Get the level of this log entry.

Returns
Log entry level.

Definition at line 175 of file log.h.

References LOG_LEVEL_MASK.

const char* LogEntry::get_name ( ) const
inline

Get the logger name of this log entry.

Returns
Log entry logger name

Definition at line 182 of file log.h.

unsigned char LogEntry::get_type ( ) const
inline

Get the type of this log entry.

Returns
Log entry type.
Since
3.6

Definition at line 161 of file log.h.

virtual const char* LogEntry::get_value ( void  ) const
inlinevirtual

Get the contents of this log entry.

Returns
Current contents of this log entry.

Reimplemented in LogEntryImpl.

Definition at line 153 of file log.h.

virtual void LogEntry::init ( void  )
virtual

Initialize a new log entry, showing timestamp, class, and level.

virtual LogEntry& LogEntry::operator+= ( const long  )
virtual

Add a numeric value to the log entry.

Parameters
l- A numeric value.
virtual LogEntry& LogEntry::operator+= ( const char *  )
virtual

Add a string value to the log entry.

Parameters
l- A numeric value.

Member Data Documentation

int LogEntry::count
protected

Definition at line 211 of file log.h.

const char* const LogEntry::name
protected

Definition at line 209 of file log.h.

unsigned char LogEntry::type
protected

Definition at line 210 of file log.h.


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