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

TLazLoggerFileHandle.WriteLnToFile

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

Declaration

Source position: lazlogger.pas line 61

public procedure TLazLoggerFileHandle.WriteLnToFile(

  const s: string;

  ALogger: TLazLogger = Nil

); virtual;

Arguments

s

  

Log message written in the method.

ALogger

  

Logger class instance passed to the OnWidgetSetDebugLn handler.

Description

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

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

The RTL WriteLn routine is called to write the value in S to the output handle for the TextRec.

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