LogEntry

Fields

struct tm

_time

Address

_host_address

LogEvent

_event_type

String

_event_comment

Functions

LogEntry

LogEntry

~LogEntry

String

ToString

Detailed Description

class LogEntry : public RED::Object

This class defines a log entry.

@related class RNET::System

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.

Public Functions

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.

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.

~LogEntry()

Destructor.

RED::String 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

the log entry formatted to a string ready to output to a log file.

Public Members

struct tm _time

the time of the log entry.

RNET::Address _host_address

network address of the host.

RNET::LogEvent _event_type

type of the event.

RED::String _event_comment

optional user comment about the event.