TLazLoggerFile class
Implements a logger which uses a file or the STDOUT device as the destination for log messages.
Declaration
TLazLoggerFile = class(TLazLoggerWithGroupParam)Inheritance
- TLazLoggerFile
- TLazLoggerWithGroupParam
- TLazLogger
- TRefCountedObject
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.
Properties
FileHandle | protected | TLazLoggerFileHandle instance representing the file or device where log messages are written. |
ParamForLogFileName | public | Name of the command line parameter that has the log file name for the class instance. |
EnvironmentForLogFileName | public | Name of the environment variable with the log file name for the class instance. |
LogName | public | The qualified name for the log file where log messages are written. |
UseStdOut | public | Enables writing to STDOUT when LogName has not been assigned. |
CloseLogFileBetweenWrites | public | Enables opening and closing the output handle for the logger following each write operation. |
Methods
DoInit | protected | Performs actions to initialize the file-based logger class instance. |
DoFinish | protected | Performs actions to finalize the file-based logger class instance. |
IncreaseIndent | protected | Increases the indentation (nesting) level for messages written using the logger. |
DecreaseIndent | protected | Decreases the indentation (nesting) level for messages written using the logger. |
IndentChanged | protected | Performs actions needed to create an indentation spacing string for the current nesting level. |
CreateIndent | protected | Creates a string with spaces characters used as the prefix for log messages. |
GetBlockHandler | protected | Gets the value for the indexed BlockHandler property. |
ClearAllBlockHandler | protected | Removes all block handlers for the logger class created using AddBlockHandler. |
DoDbgOut | protected | Performs actions needed to implement the DbgOut method for the logger class type. |
DoDebugLn | protected | Performs actions needed to implement the DebugLn method for the logger class type. |
DoDebuglnStack | protected | |
Create | public | Constructor for the class instance. |
Destroy | public | Destructor for the class instance. |
Assign | public | Implements object persistence for the TLazLoggerFile class type. |
CurrentIndentLevel | public | Gets the current indentation (nesting) level for messages written using the logger. |
AddBlockHandler | public | Adds the specified block handler to the internal list of block handlers for the logger. |
RemoveBlockHandler | public | Removes the specified block handler from the internal list of block handlers. |
BlockHandlerCount | public | Gets the number of block handlers in the internal list. |
Events
OnDebugLn | public | Event handler signalled to write a full line in the log (DebugLn, DebugLnEnter or DebugLnExit). |
OnDbgOut | public | Event handler signalled to write a log message (DbgOut). |
OnDebugLnEx | public | Event handler signalled to generate an extended log message with log group information. |
OnDbgOutEx | public | Event handler signalled to generate an extended log message with log group information. |
Inherited
From TLazLoggerWithGroupParam (3)
FindOrRegisterLogGroup ParamForEnabledLogGroups RegisterLogGroup
An experiment, built from development snapshots. Not the official Free Pascal or Lazarus documentation.
