LoggerPro (1.0)

A simple, pluggable and modern logging framework for Delphi

Unit LoggerPro

DescriptionUsesClasses, Interfaces, Objects and RecordsFunctions and ProceduresTypesConstantsVariables

Description

 

Uses

  • System.Generics.Collections
  • System.SysUtils
  • System.Classes

Overview

Classes, Interfaces, Objects and Records

Name Description
Class TLogItem Represent the single log item
Class TLoggerProEventsHandler  
Interface ILogAppender Interface implemented by all the classes used as appenders
Class ELoggerPro  
Interface ILogWriter  
Class TLoggerThread  
Class TLogWriter  
Class TLoggerProAppenderBase  

Functions and Procedures

function BuildLogWriter(aAppenders: array of ILogAppender; aEventsHandlers: TLoggerProEventsHandler = nil; aLogLevel: TLogType = TLogType.Debug): ILogWriter;

Types

TLogType = (...);
TLogErrorReason = (...);
TLogErrorAction = (...);
TLoggerProAppenderErrorEvent = reference to procedure(const AppenderClassName : string; const aFailedLogItem: TLogItem; const Reason: TLogErrorReason; var Action: TLogErrorAction);
TLogAppenderList = TList<ILogAppender>;

Variables

DefaultLoggerProMainQueueSize: Cardinal = 100000;
DefaultLoggerProAppenderQueueSize: Cardinal = 10000;

Description

Functions and Procedures

function BuildLogWriter(aAppenders: array of ILogAppender; aEventsHandlers: TLoggerProEventsHandler = nil; aLogLevel: TLogType = TLogType.Debug): ILogWriter;

Builds a new ILogWriter instance. Call this global function to start logging like a pro.

Here's a sample unit that you can use in your code

    unit LoggerProConfig;

    interface

    uses
    LoggerPro;

    function Log: ILogWriter;

    implementation

    uses
    LoggerPro.FileAppender;

    var
    _Log: ILogWriter;

    function Log: ILogWriter;
    begin
    Result := _Log;
    end;

    initialization

    //If you need other appenders, feel free to add them here in the array
    _Log := BuildLogWriter([TLoggerProFileAppender.Create(10, 5)]);

    end.
    

Add this unit to your project, then when you need to use the logger, include the unit and call one of the followings:

  • Log.Debug('This is a debug message', 'tag1')

  • Log.Info('This is an information message', 'tag1')

  • Log.Warn('This is a warning message', 'tag1')

  • Log.Error('This is an error message', 'tag1')

Types

TLogType = (...);
 
Values
  • Debug = 0:  
  • Info:  
  • Warning:  
  • Error:  
TLogErrorReason = (...);
 
Values
  • QueueFull:  
TLogErrorAction = (...);
 
Values
  • Skip:  
  • DisableAppender:  
TLoggerProAppenderErrorEvent = reference to procedure(const AppenderClassName : string; const aFailedLogItem: TLogItem; const Reason: TLogErrorReason; var Action: TLogErrorAction);
 
TLogAppenderList = TList<ILogAppender>;
 

Variables

DefaultLoggerProMainQueueSize: Cardinal = 100000;
 
DefaultLoggerProAppenderQueueSize: Cardinal = 10000;
 
Copyright 2016 Daniele Teti
Generated by PasDoc 0.14.0.