Unit CastleLog

DescriptionUsesClasses, Interfaces, Objects and RecordsFunctions and ProceduresTypesConstantsVariables

Description

Logging. Log has to be activated in your program (nothing in the Castle Game Engine activates it automatically) by InitializeLog. Various units of the engine print some logging info when Log is true.

Uses

  • Classes

Overview

Functions and Procedures

function Log: boolean;
procedure InitializeLog(const ProgramVersion: string = 'Unknown'; const ALogStream: TStream = nil);
procedure WritelnLog(const Title: string; const LogMessage: string);
procedure WritelnLog(const Title: string; const LogMessageBase: string; const Args: array of const);
procedure WriteLog(const Title: string; const LogMessage: string);
procedure WriteLogMultiline(const Title: string; const LogMessage: string);
procedure WritelnLogMultiline(const Title: string; const LogMessage: string);

Description

Functions and Procedures

function Log: boolean;

Is logging active. Initially no. Activate by InitializeLog.

procedure InitializeLog(const ProgramVersion: string = 'Unknown'; const ALogStream: TStream = nil);

Initialize logging.

If you leave ALogStream as Nil (default), then we will prints log messages to StdOut, not to some external file. This is most useful and common behavior on Unixes, where most programs log to StdOut, and StdOut is always available. It also removes any problems with users asking "where can I find the log file?". The downside is that Windows users have to explicitly redirect StdOut of the GUI program to get the log, i.e. run your program from command-line like "program.exe > log.txt". Otherwise, GUI programs (with apptype GUI) do not have StdOut available under Windows.

procedure WritelnLog(const Title: string; const LogMessage: string);

Log message. Ignored when log is not initialized (Log is False).

Although we check Log here, you can also check it yourself before even calling this procedure. This way you can avoid spending time on constructing LogMessage.

procedure WritelnLog(const Title: string; const LogMessageBase: string; const Args: array of const);

Format and log message. Ignored when log is not initialized (Log is False).

This is a shortcut for WritelnLog(Title, Format(LogMessageBase, Args)).

procedure WriteLog(const Title: string; const LogMessage: string);

Log message, without appending newline at the end (given LogMessage should already contain a final newline).

procedure WriteLogMultiline(const Title: string; const LogMessage: string);

Log multiline message. LogMessage may be multiline and must be terminated by final newline.

procedure WritelnLogMultiline(const Title: string; const LogMessage: string);

Log multiline message. LogMessage may be multiline and must not be terminated by a final newline, because we will add final newline ourselves.


Generated by PasDoc 0.14.0.