[Overview][Types][Classes][Procedures and functions][Index] Reference for unit 'LazLogger' (#lazutils)

TLazLoggerFile

[Properties (by Name)] [Methods (by Name)] [Events (by Name)]

Implements a logger which uses a file or the STDOUT device as the destination for log messages.

Declaration

Source position: lazlogger.pas line 117

type TLazLoggerFile = class(TLazLoggerWithGroupParam)

protected

  procedure DoInit; override;

  

Performs actions to initialize the file-based logger class instance.

  procedure DoFinish; override;

  

Performs actions to finalize the file-based logger class instance.

  procedure IncreaseIndent();

  

Increases the indentation (nesting) level for messages written using the logger.

  procedure DecreaseIndent();

  

Decreases the indentation (nesting) level for messages written using the logger.

  procedure IndentChanged; override;

  

Performs actions needed to create an indentation spacing string for the current nesting level.

  procedure CreateIndent; virtual;

  

Creates a string with spaces characters used as the prefix for log messages.

  function GetBlockHandler(); override;

  

Gets the value for the indexed BlockHandler property.

  procedure ClearAllBlockHandler;

  

Removes all block handlers for the logger class created using AddBlockHandler.

  procedure DoDbgOut(); override;

  

Performs actions needed to implement the DbgOut method for the logger class type.

  procedure DoDebugLn(); override;

  

Performs actions needed to implement the DebugLn method for the logger class type.

  procedure DoDebuglnStack(); override;

  

  property FileHandle: TLazLoggerFileHandle; [rw]

  

TLazLoggerFileHandle instance representing the file or device where log messages are written.

public

  constructor Create;

  

Constructor for the class instance.

  destructor Destroy; override;

  

Destructor for the class instance.

  procedure Assign(); override;

  

Implements object persistence for the TLazLoggerFile class type.

  function CurrentIndentLevel; override;

  

Gets the current indentation (nesting) level for messages written using the logger.

  property ParamForLogFileName: string; [rw]

  

Name of the command line parameter that has the log file name for the class instance.

  property EnvironmentForLogFileName: string; [rw]

  

Name of the environment variable with the log file name for the class instance.

  property OnDebugLn: TLazLoggerWriteEvent; [rw]

  

Event handler signalled to write a full line in the log (DebugLn, DebugLnEnter or DebugLnExit).

  property OnDbgOut: TLazLoggerWriteEvent; [rw]

  

Event handler signalled to write a log message (DbgOut).

  property OnDebugLnEx: TLazLoggerWriteExEvent; [rw]

  

Event handler signalled to generate an extended log message with log group information.

  property OnDbgOutEx: TLazLoggerWriteExEvent; [rw]

  

Event handler signalled to generate an extended log message with log group information.

  procedure AddBlockHandler(); override;

  

Adds the specified block handler to the internal list of block handlers for the logger.

  procedure RemoveBlockHandler(); override;

  

Removes the specified block handler from the internal list of block handlers.

  function BlockHandlerCount; override;

  

Gets the number of block handlers in the internal list.

  property LogName: string; [rw]

  

The qualified name for the log file where log messages are written.

  property UseStdOut: Boolean; [rw]

  

Enables writing to STDOUT when LogName has not been assigned.

  property CloseLogFileBetweenWrites: Boolean; [rw]

  

Enables opening and closing the output handle for the logger following each write operation.

end;

Inheritance

TLazLoggerFile

  

Implements a logger which uses a file or the STDOUT device as the destination for log messages.

|

TLazLoggerWithGroupParam

  

Defines a logger which allows enabling / disabling groups from the command line.

|

TLazLogger

  

Defines the base class for loggers used in the Lazarus IDE.

|

TRefCountedObject

  

Implements a thread-safe reference-counted class which performs free notifications.

|

TFreeNotifyingObject

  

Base class used to implement objects which perform free notifications.

|

TObject

Description

TLazLoggerFile is a TLazLoggerWithGroupParam descendant. It provides properties and methods needed to implement the handle-based logger class. It also provides event handlers used to perform DbgOut and DebugLn write events (when assigned).

TLazLoggerFileHandle provides a FileHandle property (TLazLoggerFileHandle instance) to represent the handle for the output device or file.

Various methods from ancestor classes are overridden to perform actions needed to format log messages for the destination.

Use LogName to specify a file name where log messages are stored.

Use the UseStdOut property to indicate that the STDOUT device is used (instead of a file name) to output the log messages for the class instance. Set LogName to an empty string ('') to ensure that STDOUT is used.

Use CloseLogFileBetweenWrites to force the output handle to be closed and released when a write operation is completed. This is the default behavior for the WinCE platform.


Version 4.0 Generated 2025-05-03 Home