Skip to content

How to create a log file

Kittox includes a pluggable logging system that writes trace data useful for debugging or custom application events. Multiple loggers can be active at once.

Quick setup

Add a Log node to your Config.yaml:

yaml
Log:
  Level: 5
  TextFile:
    FileName: %APP_PATH%log.txt
    IsEnabled: True

Then include the corresponding unit in your UseKitto.pas:

pascal
uses
  EF.Logger.TextFile;

Log levels

The Level parameter controls the verbosity of log output:

LevelDescription
1Minimal — errors and critical events only
2Warnings
3Informational messages
4Verbose
5Debug — full trace output

Available loggers

LoggerUnitConfig sectionDescription
TextFileEF.Logger.TextFileTextFileWrites to a plain text file
CodeSiteEF.Logger.CodeSiteCodeSiteSends log data to the CodeSite viewer (any edition)

Each logger section must contain at least IsEnabled: True. You can disable a logger without removing its configuration by setting IsEnabled: False.

Custom loggers

You can create your own loggers by inheriting from TEFLogEndpoint and overriding the DoLog method. Register the class in the initialization section and unregister in the finalization section to make it available to the system.

See Logging for the full reference.

Released under Apache License, Version 2.0.