class RNET::LogEntry
This class defines a log entry. More...
#include <RNETLog.h>
Inherits: Object.
Public functions:
LogEntry ( RNET::LogEvent iEventType, const RED::String & iComment = "" ) | |
LogEntry ( const RED::String & iString ) | |
~LogEntry ( ) | |
RED::String | ToString ( ) const |
Public variables:
RED::String | _event_comment |
RNET::LogEvent | _event_type |
RNET::Address | _host_address |
struct tm | _time |
Detailed description:
This class defines a log entry.
REDnet can log network events. Each log entry encodes various information about the event (network address, type, date, user-defined event comment).
The date of a log entry is the one of the machine with local time zone correction applied to and follows the ANSI definition of struct tm.
The log entry is output as:
[host IP];[Event date];[Event type];[Event comment]
where:
- [host IP] follows [xxx.xxx.xxx.xxx] where '.' are used to separate the address fields.
- [Event date] follows [ss/mm/hh/dd/MM/yy/ww/DD/ff] where ss are seconds, mm are minutes, hh are hours, dd is day of the month, MM is month, yy is years since 1900, ww is days since Sunday, DD is days since January and ff is the daylight savings time flag.
- [Event type] is a direct dump of the RNET::LOG_EVENT event value
- [Event comment] optional user defined comment for the event
When logging is enabled (through RNET::System::EnableLog), log entries are output either to a file or to a user-defined callback.
Functions documentation
public RNET::LogEntry::LogEntry | ( | RNET::LogEvent | iEventType, |
const RED::String & | iComment = "" | ||
) |
Constructor.
The entry sets itself the date at which it's created.
Parameters:
iEventType | type of the logged event. |
iComment | optional user comment to be added to the log entry. |
public RNET::LogEntry::LogEntry | ( | const RED::String & | iString | ) |
Constructor.
Build back a log entry from its string version.
The string version of a log entry can be built by calling RNET::LogEntry::ToString().
If the supplied string is not a valid log entry the resulting object may be undefined.
Parameters:
iString | string version of a log entry. |
public RNET::LogEntry::~LogEntry | ( | ) |
Destructor.
public RED::String RNET::LogEntry::ToString | ( | ) const |
Formats the log entry content to a string.
See RNET::System::EnableLog for details about the string format.
A carrier return char is appended at the end of the returned string.
Returns:
Variables documentation
optional user comment about the event.
type of the event.
network address of the host.
the time of the log entry.