SNMP++  3.3.4
AgentLogImpl Class Reference

The AgentLogImpl class is an implementation of AgentLog which writes log messages to a file, or to stdout or stderr. More...

#include <log.h>

Inheritance diagram for AgentLogImpl:
Collaboration diagram for AgentLogImpl:

Public Member Functions

 AgentLogImpl (FILE *=stdout)
 Default constructor, with optional pointer to an open log file. More...
 
 AgentLogImpl (const char *)
 Constructor with file name of a log file. More...
 
 ~AgentLogImpl ()
 Destructor. More...
 
void set_dest (const char *)
 Set destination of logs to a given file. More...
 
void set_dest (FILE *)
 Set destination of logs to a given file. More...
 
virtual LogEntrycreate_log_entry (const char *const name, unsigned char) const
 Create a new LogEntry. More...
 
virtual AgentLogoperator+= (const LogEntry *)
 Add a LogEntry to the receiver Log. More...
 
- Public Member Functions inherited from AgentLog
 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 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...
 

Protected Attributes

FILE * logfile
 
bool close_needed
 
- Protected Attributes inherited from AgentLog
unsigned char logfilter [LOG_TYPES]
 
char static_buf [18]
 

Additional Inherited Members

- Static Public Member Functions inherited from AgentLog
static const char * get_current_time ()
 Return the current time as a string, using the current default log object. More...
 

Detailed Description

The AgentLogImpl class is an implementation of AgentLog which writes log messages to a file, or to stdout or stderr.

See Also
LogEntry
Author
Frank Fock
Version
3.5f

Definition at line 414 of file log.h.

Constructor & Destructor Documentation

AgentLogImpl::AgentLogImpl ( FILE *  = stdout)

Default constructor, with optional pointer to an open log file.

Log is directed to the file if given, otherwise to stdout

Parameters
fp- An open log file. 0 implies stdout.
AgentLogImpl::AgentLogImpl ( const char *  )

Constructor with file name of a log file.

Log is directed to the given file.

Parameters
fname- The file name of a log file.
AgentLogImpl::~AgentLogImpl ( )

Destructor.

Member Function Documentation

virtual LogEntry* AgentLogImpl::create_log_entry ( const char *const  name,
unsigned  char 
) const
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).

Implements AgentLog.

virtual AgentLog& AgentLogImpl::operator+= ( const LogEntry )
virtual

Add a LogEntry to the receiver Log.

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

Implements AgentLog.

void AgentLogImpl::set_dest ( const char *  )

Set destination of logs to a given file.

Parameters
fname- A file name. "" directs logs to stdout.
void AgentLogImpl::set_dest ( FILE *  )

Set destination of logs to a given file.

Parameters
fp- A pointer to an open file. 0 directs logs to stdout.

Member Data Documentation

bool AgentLogImpl::close_needed
protected

Definition at line 470 of file log.h.

FILE* AgentLogImpl::logfile
protected

Definition at line 469 of file log.h.


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