Sign in Join
FPDoc Onlineexperiment

TLazLoggerFile class

In unit LazLogger

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

Declaration

pascal
TLazLoggerFile = class(TLazLoggerWithGroupParam)

Inheritance

  1. TLazLoggerFile
  2. TLazLoggerWithGroupParam
  3. TLazLogger
  4. 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

FileHandleprotectedTLazLoggerFileHandle instance representing the file or device where log messages are written.
ParamForLogFileNamepublicName of the command line parameter that has the log file name for the class instance.
EnvironmentForLogFileNamepublicName of the environment variable with the log file name for the class instance.
LogNamepublicThe qualified name for the log file where log messages are written.
UseStdOutpublicEnables writing to STDOUT when LogName has not been assigned.
CloseLogFileBetweenWritespublicEnables opening and closing the output handle for the logger following each write operation.

Methods

DoInitprotectedPerforms actions to initialize the file-based logger class instance.
DoFinishprotectedPerforms actions to finalize the file-based logger class instance.
IncreaseIndentprotectedIncreases the indentation (nesting) level for messages written using the logger.
DecreaseIndentprotectedDecreases the indentation (nesting) level for messages written using the logger.
IndentChangedprotectedPerforms actions needed to create an indentation spacing string for the current nesting level.
CreateIndentprotectedCreates a string with spaces characters used as the prefix for log messages.
GetBlockHandlerprotectedGets the value for the indexed BlockHandler property.
ClearAllBlockHandlerprotectedRemoves all block handlers for the logger class created using AddBlockHandler.
DoDbgOutprotectedPerforms actions needed to implement the DbgOut method for the logger class type.
DoDebugLnprotectedPerforms actions needed to implement the DebugLn method for the logger class type.
DoDebuglnStackprotected
CreatepublicConstructor for the class instance.
DestroypublicDestructor for the class instance.
AssignpublicImplements object persistence for the TLazLoggerFile class type.
CurrentIndentLevelpublicGets the current indentation (nesting) level for messages written using the logger.
AddBlockHandlerpublicAdds the specified block handler to the internal list of block handlers for the logger.
RemoveBlockHandlerpublicRemoves the specified block handler from the internal list of block handlers.
BlockHandlerCountpublicGets the number of block handlers in the internal list.

Events

OnDebugLnpublicEvent handler signalled to write a full line in the log (DebugLn, DebugLnEnter or DebugLnExit).
OnDbgOutpublicEvent handler signalled to write a log message (DbgOut).
OnDebugLnExpublicEvent handler signalled to generate an extended log message with log group information.
OnDbgOutExpublicEvent handler signalled to generate an extended log message with log group information.

Inherited

From TLazLoggerWithGroupParam (3)

FindOrRegisterLogGroup ParamForEnabledLogGroups RegisterLogGroup

From TLazLogger (12)

DbgOut DebugLn DebugLnEnter DebugLnExit DebuglnStack DumpExceptionBackTrace Finish Init LogGroupList MaxNestPrefixLen NestLvlIndent UseGlobalLogGroupList

An experiment, built from development snapshots. Not the official Free Pascal or Lazarus documentation.