SNMP++  3.3.11
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 ()
 Initialize a new log entry, showing timestamp, class, and level. More...
 
virtual LogEntryoperator+= (const long l)
 Add a numeric value to the log entry. More...
 
virtual LogEntryoperator+= (const char *s)
 Add a string value to the log entry. More...
 
virtual const char * get_value () 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 *s)=0
 Add a string to the log. More...
 
virtual bool add_integer (long s)
 Add an integer to the log. More...
 
virtual bool add_timestamp ()
 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 112 of file log.h.

Constructor & Destructor Documentation

◆ LogEntry()

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 123 of file log.h.

◆ ~LogEntry()

virtual LogEntry::~LogEntry ( )
inlinevirtual

Virtual destructor.

Definition at line 128 of file log.h.

Member Function Documentation

◆ add_integer()

virtual bool LogEntry::add_integer ( long  s)
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.

◆ add_string()

virtual bool LogEntry::add_string ( const char *  s)
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.

◆ add_timestamp()

virtual bool LogEntry::add_timestamp ( )
protectedvirtual

Add the current time to the log.

◆ get_class()

unsigned char LogEntry::get_class ( ) const
inline

Get the class of this log entry.

Returns
Log entry class.

Definition at line 169 of file log.h.

References LOG_CLASS_MASK.

◆ get_level()

unsigned char LogEntry::get_level ( ) const
inline

Get the level of this log entry.

Returns
Log entry level.

Definition at line 176 of file log.h.

References LOG_LEVEL_MASK.

◆ get_name()

const char* LogEntry::get_name ( ) const
inline

Get the logger name of this log entry.

Returns
Log entry logger name

Definition at line 183 of file log.h.

◆ get_type()

unsigned char LogEntry::get_type ( ) const
inline

Get the type of this log entry.

Returns
Log entry type.
Since
3.6

Definition at line 162 of file log.h.

◆ get_value()

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

Get the contents of this log entry.

Returns
Current contents of this log entry.

Reimplemented in LogEntryImpl.

Definition at line 154 of file log.h.

◆ init()

virtual void LogEntry::init ( )
virtual

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

◆ operator+=() [1/2]

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

Add a numeric value to the log entry.

Parameters
l- A numeric value.

◆ operator+=() [2/2]

virtual LogEntry& LogEntry::operator+= ( const char *  s)
virtual

Add a string value to the log entry.

Parameters
s- A string value.

Member Data Documentation

◆ count

int LogEntry::count
protected

Definition at line 212 of file log.h.

◆ name

const char* const LogEntry::name
protected

Definition at line 210 of file log.h.

◆ type

unsigned char LogEntry::type
protected

Definition at line 211 of file log.h.


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