-
Notifications
You must be signed in to change notification settings - Fork 9
Home
Michael Justin edited this page Feb 5, 2016
·
25 revisions
To register a specific logging framework, just add one of the djLogOver...
units to the project.
Available binding units: djLogOverSimpleLogger
, djLogOverNOPLogger
, djLogOverLog4D
program Test;
interface
uses
djLogOverSimpleLogger, // registers the 'simple' logger implementation
UnitA, ...
...;
begin
...
end.
This unit will register Log4D as the logging framework. Configuration of Log4D must be applied as usual, either by invoking file based configuration, or by setting properties in application code (or both).
This unit will register SimpleLogger as the logging framework. For configuration please check its Wiki page.
This unit will register NOPLogger as logging framework. NOPLogger actually does nothing, so it is equivalent to disabling logging for the program.
unit UnitA;
interface
uses
...
djLogAPI, djLoggerFactory;
type
TMyMainClass = class(TObject)
private
Logger: ILogger;
...
public
constructor Create;
...
end;
...
constructor TMyMainClass.Create;
begin
inherited;
Logger := TdjLoggerFactory.GetLogger('main.Logger');
Logger.Trace('Creating instance of TMyMainClass.');
...
end;
Log output:
42 TRACE main.Logger - Creating instance of TMyMainClass.