Skip to content

TEventLog

Event logging class.

Declaration

Source position: eventlog.pp line 41

type

  TEventLog = class(TComponent)
  public
    constructor Create;
    destructor Destroy;
    class function EventTypeName : string;
    function EventTypeToString : string;
    function RegisterMessageFile : Boolean;
    function UnRegisterMessageFile : Boolean;
    procedure Pause;
    procedure Resume;
    procedure Log(EventType: TEventType; const Msg: string);
    procedure Log(EventType: TEventType; const Fmt: string; 
             Args: Array of const);
    procedure Log(const Msg: string);
    procedure Log(const Fmt: string; Args: Array of const);
    procedure Warning(const Msg: string);
    procedure Warning(const Fmt: string; Args: Array of const);
    procedure Error(const Msg: string);
    procedure Error(const Fmt: string; Args: Array of const);
    procedure Debug(const Msg: string);
    procedure Debug(const Fmt: string; Args: Array of const);
    procedure Info(const Msg: string);
    procedure Info(const Fmt: string; Args: Array of const);
  published
    property AppendContent: Boolean; {rw}
    property Identification: string; {rw}
    property EventFilter: TEventTypes; {rwd}
    property LogType: TLogType; {rw}
    property Active: Boolean; {rw}
    property RaiseExceptionOnError: Boolean; {rw}
    property DefaultEventType: TEventType; {rw}
    property FileName: string; {rw}
    property TimeStampFormat: string; {rw}
    property CustomLogType: Word; {rw}
    property EventIDOffset: DWord; {rw}
    property OnGetCustomCategory: TLogCategoryEvent; {rw}
    property OnGetCustomEventID: TLogCodeEvent; {rw}
    property OnGetCustomEvent: TLogCodeEvent; {rw}
    property OnLogMessage: TLogMessageEvent; {rw}
    property OnFormattedLogMessage: TLogMessageEvent; {rw}
    property Paused: Boolean; {rw}
  end;

Description

TEventLog is a component which can be used to send messages to the system log. In case no system log exists (such as on Windows 95/98 or DOS), the messages are written to a file. Messages can be logged using the general Log call, or the specialized Warning, Error, Info or Debug calls, which have the event type predefined.

Properties

Member Visibility Description
Active published Activate the log mechanism.
AppendContent published Control whether output is appended to an existing file.
CustomLogType published Custom log type ID.
DefaultEventType published Default event type for the Log call.
EventFilter published
EventIDOffset published Offset for event ID messages identifiers.
FileName published File name for log file.
Identification published Identification string for messages.
LogType published Log type.
Paused published Is the message sending paused ?
RaiseExceptionOnError published Determines whether logging errors are reported or ignored.
TimeStampFormat published Format for the timestamp string.
See all Properties

Methods

Member Visibility Description
Create public
Debug public Log a debug message.
Destroy public Clean up TEventLog instance.
Error public Log an error message to.
EventTypeName public
EventTypeToString public Create a string representation of an event type.
Info public Log an informational message.
Log public Log a message to the system log.
Pause public Pause the sending of log messages.
RegisterMessageFile public Register message file.
Resume public Resume sending of log messages if sending was paused.
UnRegisterMessageFile public Unregister the message file (needed on windows only).
Warning public Log a warning message.
See all Methods

Events

Member Visibility Description
OnFormattedLogMessage published
OnGetCustomCategory published Event to retrieve custom message category.
OnGetCustomEvent published Event to retrieve custom event Code.
OnGetCustomEventID published Event to retrieve custom event ID.
OnLogMessage published Implement custom handling of log messages.
See all Events

See also

Name Description
Log Log a message to the system log.
Warning Log a warning message.
Error Log an error message to.
Info Log an informational message.
Debug Log a debug message.