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>
|
static const char * | get_current_time () |
| Return the current time as a string, using the current default log object. More...
|
|
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 302 of file log.h.
◆ AgentLog()
◆ ~AgentLog()
virtual AgentLog::~AgentLog |
( |
| ) |
|
|
inlinevirtual |
Virtual destructor.
Definition at line 312 of file log.h.
◆ create_log_entry()
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.
◆ get_current_time()
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.
◆ get_filter()
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
◆ log_needed()
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
-
t | the 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 371 of file log.h.
References LOG_LEVEL_MASK.
◆ now()
virtual const char* AgentLog::now |
( |
char * |
buf = 0 | ) |
|
|
virtual |
Return the current time as a string.
- Parameters
-
buf | a buffer (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.
◆ operator+=()
Add a LogEntry to the receiver Log.
- Parameters
-
- Returns
- The receiver log itself.
Implemented in AgentLogImpl.
◆ set_filter()
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. |
◆ logfilter
◆ static_buf
char AgentLog::static_buf[18] |
|
protected |
The documentation for this class was generated from the following file: