Write message to log

Writes the text to the log. Does not append a new line.

The Argument can be:

One or more string

An open array of const: All values are converted to string and joined

A single string and open array of const: Will be passed to Format

Any of the above with a PLazLoggerLogGroup as filter

This is a forwarder to the log TLazLogger object. See there for details.

DebugLogger
Write message to log

Writes the text to the log. Does append a new line.

The Argument can be:

One or more string

An open array of const: All values are converted to string and joined

A single string and open array of const: Will be passed to Format

Any of the above with a PLazLoggerLogGroup as filter

This is a forwarder to the log TLazLogger object. See there for details.

DebugLogger
Write message to log

Writes the text to the log. Does append a new line. Increases the current intend.

The Argument can be:

One or more string

An open array of const: All values are converted to string and joined

A single string and open array of const: Will be passed to Format

Any of the above with a PLazLoggerLogGroup as filter

This is a forwarder to the log TLazLogger object. See there for details.

DebugLogger
Write message to log

Writes the text to the log. Does append a new line. Increases the current intend.

The Argument can be:

One or more string

An open array of const: All values are converted to string and joined

A single string and open array of const: Will be passed to Format

Any of the above with a PLazLoggerLogGroup as filter

This is a forwarder to the log TLazLogger object. See there for details.

DebugLogger
A log writer object

Provides functionality to write messages to a log file. Allows filtering and changing indent level.

Can parse options from command line for log filename and filter settings.

An application can subclass the logger to add it's own functionality

The name of the log file
This can be set by the application.

Alternatively it can be determined according to ParamForLogFileName and EnvironmentForLogFileName
Name of the command line option, that has the logfile's name
If LogName is empty and this is set, then the commandline will be checked for a param of the name specified. LogName will be set, if found.

The default is --debug-log= Note that the dashes and equal sign must be present.
Write message to log

Writes the text to the log. Does not append a new line.

The Argument can be:

One or more string

An open array of const: All values are converted to string and joined

A single string and open array of const: Will be passed to Format

Any of the above with a PLazLoggerLogGroup as filter

DebugLogger
Write message to log

Writes the text to the log. Does append a new line.

The Argument can be:

One or more string

An open array of const: All values are converted to string and joined

A single string and open array of const: Will be passed to Format

Any of the above with a PLazLoggerLogGroup as filter

DebugLogger
Write message to log

Writes the text to the log. Does append a new line. Increases the current intend.

The Argument can be:

One or more string

An open array of const: All values are converted to string and joined

A single string and open array of const: Will be passed to Format

Any of the above with a PLazLoggerLogGroup as filter

DebugLogger
Write message to log

Writes the text to the log. Does append a new line. Increases the current intend.

The Argument can be:

One or more string

An open array of const: All values are converted to string and joined

A single string and open array of const: Will be passed to Format

Any of the above with a PLazLoggerLogGroup as filter

DebugLogger
Name of the environment, that has the logfile's name
If LogName is empty and con not be found from ParamForLogFileName, then the environment variable specified will be checked. LogName will be set, if found.

* will be replaced by param(0)

The default is: *_debuglog
Enable writing to STDOUT, if LogName is not set
Enable opening and closing the log for each write
Event when writing a full line (Debugln, DebuglnEnter or DebuglnExit)
The event contains the text to be logged. It also has a handled var param, that can be set to True to prevent default action (writing to log)
Event when writing without line end (DbgOut)
The event contains the text to be logged. It also has a handled var param, that can be set to True to prevent default action (writing to log)
Indent to be added for each DebuglnEnter
Default is 2
Maxmum indent for DebuglnEnter
If the indent reaches this value, it will not increase anymore. Instead each line is prefixed with the nest-level of DebuglnEnter

Default is 15
Register a named filter
var MyFilter: PLazLoggerLogGroup;

initialization MyFilter := DebugLogger.RegisterLogGroup('MyFilterName');

then write debugln(MyFilter, ['Notice: ', SomeText]);

The filter can be enabled via the command line. See ParamForEnabledLogGroups
Name of the command line option, to enable or disable LogGroups
List of all LogGroups
Provides a log framework
LazLogger provides logging facilities to write message to a file. Messages can be logged plain, or enclosed in begin/end like blocks, adding indent to all messages between to points (blocks can be nested). It also has the ability to filter groups of messages.

It can reads the command line and environment to find the desired filename. By default it looks for --debug-log= on the command line or "appname"_debuglog in environment.

If no log name is found StdOut is used.

The simples usage, is to use the unit and put "DebugLn"/ "DbgOut" / "DebugLnEnter"/ "DebugLnExit" in your code. This works without any further setup.