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

TLazLoggerFileHandle.WriteToFile

Writes the specified log message to the output handle for the class instance.

Declaration

Source position: lazlogger.pas line 60

public procedure TLazLoggerFileHandle.WriteToFile(

  const s: string;

  ALogger: TLazLogger = Nil

); virtual;

Arguments

s

  

Log message written in the method.

ALogger

  

Logger class instance passed to the OnWidgetsetDbgOut handler.

Description

WriteToFile ensures that the OnWidgetsetDbgOut routine is signalled (when assigned for the unit) to perform the write operation. If the message is handled in OnWidgetsetDbgOut, no additional actions are performed in the method.

Otherwise, the output handle is opened when not already assigned. If ActiveLogText is unassigned after trying to open the output handle, no additional actions are performed in the method.

The RTL Write routine is called to write the value in S to the output handle for the TextRec. The Flush routine is called when needed for the platform.

When CloseLogFileBetweenWrites is set to True, the output handle is closed and released.

If an exception occurs during output to the handle, it is caught and the values in WriteFailedCount and LastWriteFailed are updated to reflect the error condition.


Version 4.0 Generated 2025-05-03 Home