Indy 9
TIdLogBase
Hierarchy, Properties, Methods, Events, See Also, Unit: IdLogBase
Defines a component logging Framework.
TIdLogBase = class(TIdConnectionIntercept)
Unit
IdLogBase
Description
TIdLogBase is an abstract class that defines a framework for logging information about Indy communication components.

TIdLogBase is a descendant of TIdConnectionIntercept. TIdLogBase implements inherited virtual methods to write text strings to a log when TIdSocketHandle operations are performed. These operations include connect, read, write, and disconnect.

Messages written to the log may optionally transform all EOL characters, (Carriage Return + Line Feed) by default, to the token '<EOL>'. A log message can optionally generate the date and time it was written to the log.

Note: TIdLogBase does not specify the destination for log messages. TIdLogBase descendants must implement the virtual methods in the class to resolve where log messages are stored, or written.

TIdLogBase is the ancestor class for the TIdLogDebug component. TIdLogDebug demonstrates an implementation that can store messages in a file stream or write messages to the standard Debugger Output.


TIdLogBase.Active
TIdLogBase, See Also
Start or stop logging of messages.
property Active: Boolean;
Description
Active is used to start or stop logging of messages from Send and Receive operations performed using the Binding socket handle. Set Active to True to begin message logging. The logging destination will be Opened if it is currently Closed. Set Active to False to stop message logging. The logging destination will be Closed if it is currently Open.

TIdLogBase.LogTime
TIdLogBase
Specifies if log messages are date- and time-stamped.
property LogTime: Boolean;
Description
LogTime is a Boolean property that indicates if the log message should automatically include the current date and time when the message is created. The default value for LogTime is True, as assigned in the Create constructor.

If LogTime is True, a message will have the current date and time prepended to the message contents. Date and time is formatted using the value given in the global ShortDateFormat variable.

LogTime is called from virtual methods in the class as a part of message formatting routines.


TIdLogBase.ReplaceCRLF
TIdLogBase, See Also
Indicates that line-end characters in a message should be replace with tags.
property ReplaceCRLF: Boolean;
Description
ReplaceCRLF is a Boolean property that indicates if the line-end characters CR, LF, and EOL in a log message should be replace with their tag counterparts "<CR>", "<LF>", and "<EOL>". ReplaceCRLF is usedin the Receive and Send methods prior to writing of the log message.

TIdLogBase.Connect
TIdLogBase, See Also
Writes a log message when a connection is established.
procedure Connect(AConnection: TComponent); override;
Parameters
AConnection: TComponent
Component establishing the connection.
Description
Connect is a procedure used to write a log message when a connection is opened for the component in AConnection. The log message will contain an optional date, and the operation name. For example:

      01/01/20000 13:03:42: Connected.

Set LogTime to True to include date and time information in the log message.

Connect calls the inherited Connect method prior to generating the status message.


TIdLogBase.Create
TIdLogBase, See Also
Constructor for the object instance.
constructor Create(AOwner: TComponent); override;
Parameters
AOwner: TComponent
Owner of the object instance.
Description
Create is the overridfen constructor for the object instance. Create relies on the inherited Create constructor, and sets the default values of LogTime (True) and ReplaceCRLF (True).

Note: Applications should not create instances of TIdLogBase. Create a TIdLogBase descendant, like TIdLogDebug, that implements the abstract methods for writing and storing messages to the desired destination.


TIdLogBase.Destroy
TIdLogBase, See Also
Frees the object instance.
destructor Destroy; override;
Description
Destroy is the Destructor for the object instance. Destroy insures that the logging component is not Active prior to calling the inherited Destructor.

TIdLogBase.Disconnect
TIdLogBase, See Also
Writes a log message and closes a connection.
procedure Disconnect; override;
Description
Disconnect is a procedure used to write a log message when a connection is closed. The log message will contain an optional date, and the operation name. For example:

      01/01/20000 13:03:42: Disconnected.

Set LogTime to True to include date and time information in the log message. Connect relies on a virtual ethod to perform formatting and output of messages to the log.

Disconnect calls the inherited Disconnect method to reset the component that owns the connection.


TIdLogBase.Receive
TIdLogBase, See Also
Implements writing of stream-based messages to the logging destination for Receive operations.
procedure Receive(ABuffer: TStream); override;
Parameters
ABuffer: TStream
Stream containing the message to be logged.
Description
Receive is an overriden procedure in TIdLogBase that implements logging of message contents for the stream ABuffer for Receive operations. Receive calls the inherited method prior to constructing the contents of the log message from the input stream. Receive relies on a virutal method in the class to perform output of the log message to the logging destination.

When LogTime is True, the current date and time stamp is prepended to the log message.

When ReplaceCRLF is True, all instances of CR, LF, and EOL in the message are replaced with their tag counterparts, "<CR>", "<LF>", and "<EOL>".


TIdLogBase.Send
TIdLogBase, See Also
Implements writing of stream-based messages to the logging destination for Send operations.
procedure Send(ABuffer: TStream); override;
Parameters
ABuffer: TStream
Stream containing the message to be logged.
Description
Send is an overriden procedure in TIdLogBase that implements logging of message contents for the stream ABuffer for Send operations. Send calls the inherited method prior to constructing the contents of the log message from the input stream. Send relies on a virutal method in the class to perform output of the log message to the logging destination.

When LogTime is True, the current date and time stamp is prepended to the log message.

When ReplaceCRLF is True, all instances of CR, LF, and EOL in the message are replaced with their tag counterparts, "<CR>", "<LF>", and "<EOL>".


Created with Doc-O-Matic 2 donated to Project JEDI. Commercial license available from the Doc-O-Matic site.