loggerpro

2025-12-10 0 301

LoggerPro for Delphi

An modern and pluggable logging framework for Delphi

Compatibility

LoggerPro is compatibile with

  • Delphi 12 Athens
  • Delphi 11 Alexandria
  • Delphi 10.4 Sydney
  • Delphi 10.3 Rio
  • Delphi 10.2 Tokyo (Added Linux compatibility)
  • Delphi 10.1 Berlin
  • Delphi 10 Seattle
  • Delphi XE8
  • Delphi XE7
  • Delphi XE6
  • Delphi XE5
  • Delphi XE4
  • Delphi XE3
  • Delphi XE2

What\’s new in 2.0.0 (repo version, beta)

  • Delphi 12 Athens Support
  • FIX #72
  • New LogLevel: FATAL (#80)
  • New Appender: JSONL
  • Added ILogItemRenderers (check samples)

What\’s new in 1.4.0 (stable version)

  • Improved VCL and FMX visual appenders
  • Appenders can be added and removed programmatically
  • Added packages for latest versions of Delphi
  • Improved algorithm used to handle slow consumers
  • Added DMSContainer\’s EventStreams Appender
  • Added very basic console appender that assumes is running from console in order to provide simple Linux console logging
  • FIX Issue 50
  • New filtering log file appender that allows to pick individual tags to be written into a file.
  • FIX Issue 57
  • FIX Issue 60

What\’s new in 1.3.2

  • Added support for Android API level 26 in mobile demo
  • Added packages for Delphi 10.3 Rio, Delphi 10.2 Tokyo, Delphi 10.1 Berlin and Delphi 10.0 Seattle.
  • Added packages for Delphi XE7 and Delphi XE8 (these packages do not contain appenders which uses System.Net.HttpClient)
  • Added support for Linux in TLoggerProFileAppender (Thank you charoit)

What\’s new in 1.3.0

  • Replace TThreadedList<T> with a custom implementation (TThreadSafeQueue<T>) because of a bug and this in TMonitor.
    • TThreadSafeQueue<T> is not a drop-in replacement for the TThreadedQueue<T> but can be used in other projects if you are fighting with the same bug.
  • TVCLMemoLogAppender.Create gots new parameter: aClearOnStartup which optionally clear the memo at the startup.
  • Improvement to the TLoggerProConsoleAppender (Thanks to Fulgan)
  • Improvement to the TLoggerProFileAppender; now there is a OnLogRow callback that can be used to customize log row format.
  • New overloaded Log methods. The *Fmt versions are deprecated and will be removed in a future version ISSUE #17
  • New NSQ appender (Thanks to Fulgan)
  • New logger filter decorator (Thanks to Fulgan)
  • New REST appender with support for extended information (samples for Windows and Android)
    • Extended information are supported in Windows (fully) and Android (partially)
    • In the sample folder is provided also the RESTLogCollector
  • New Elastic Search Log appender (Thanks to Salvatore Sparacino)

Getting started

program getting_started_console;

{$APPTYPE CONSOLE}

uses
  System.SysUtils,
  LoggerPro.GlobalLogger; //this is the global logger, it is perfect to understand the basic operation of LoggerPro.

begin
  try
    //the global logger uses a TLoggerProFileAppender, so your logs will be written on a 
    //set of files with automatic rolling/rotating
    
    Log.Debug(\'Debug message\', \'main\'); //TLoggerProFileAppender uses the \"tag\" to select a different log file	
    Log.Info(\'Info message\', \'main\');
    Log.Warn(\'Warning message\', \'main\');
    Log.Error(\'Error message\', \'errors\');
    WriteLn(\'Check \"getting_started_console.00.main.log\" and \"getting_started_console.00.errors.log\" to see your logs\');
    ReadLn;
  except
    on E: Exception do
      Writeln(E.ClassName, \': \', E.Message);
  end;

end.

The most flexible/correct approach is not much complicated than the global logger one. Check how is simple to create a custom instance of logwriter

program getting_started_console_appenders;

{$APPTYPE CONSOLE}

uses
  System.SysUtils,
  LoggerPro, //LoggerPro core
  LoggerPro.FileAppender, //File appender
  LoggerPro.OutputDebugStringAppender; //OutputDebugString appender

var
  Log: ILogWriter;

begin
  Log := BuildLogWriter([TLoggerProFileAppender.Create,
    TLoggerProOutputDebugStringAppender.Create]);

  try
    Log.Debug(\'Debug message\', \'main\');
    Log.Info(\'Info message\', \'main\');
    Log.Warn(\'Warning message\', \'main\');
    Log.Error(\'Error message\', \'errors\');
    WriteLn(\'Check \');
    WriteLn(\'  \"getting_started_console.00.main.log\"\');
    WriteLn(\'  \"getting_started_console.00.errors.log\"\');

    if DebugHook <> 0 then //inform the user where his/her logs are
    begin
      WriteLn(\'also, you logs have been sent to the current debugger, check the Delphi\'\'s EventLog window to see them.\');
    end
    else
    begin
      WriteLn(\'..seems that no debugger is present. The logs can be seen using DebugView.\');
      WriteLn(\'Download it from here https://technet.**m*icrosoft.com/en-us/sysinternals/debugview.aspx\');
      WriteLn(\'Learn how to use http://t*e*d*gustaf.com/blog/2011/5/use-debugview-to-view-debug-output-from-asp-net-web-application/\');
    end;
    ReadLn;
  except
    on E: Exception do
      WriteLn(E.ClassName, \': \', E.Message);
  end;

end.

Built-in log appenders

The framework contains the following built-in log appenders

  • File appender (TLoggerProFileAppender) (v1.0.0+)
  • Console appender (TLoggerProConsoleAppender) (v1.0.0+)
  • OutputDebugString appender (TLoggerProOutputDebugStringAppender) (v1.0.0+)
  • VCL Memo appender (TVCLMemoLogAppender) (v1.0.0+)
  • VCL ListView appender (TVCLMemoLogAppender) — thanks to https://*gi**thub.com/he3p94uu (v1.3.0+)
  • Redis Appender with LogsViewer(to aggregate logs from different instances on a single Redis instance) (v1.2.0+)
  • Email appender (to send email as log, very useful for fatal errors) (v1.2.0+)
  • SysLog appender RFC 5424 compliant — thanks to https://gi*t*hub.co*m/nurettin (v1.3.0+)
  • NSQ appender (Thanks to Fulgan) (v1.3.0+)
  • Decorator appender (Thanks to Fulgan) (v1.3.0+)

Next appenders in the development pipeline

  • RESTful Appender (to send logs to a rest endpoint using a specific request format, so that you can implement log server in DelphiMVCFramework, PHP, Java, Python, Node etc)
  • Twitter Appender (to send logs to a Twitter Account)
  • Database appender (to send logs to a database table using FireDAC components — Thank You Omar Bossoni)

The log writers and all the appenders are asycnhronous.

Check the samples to see how to use each appender or even combine different appenders.

Documentation

Documentation is available in the docs folder as HTML.

Other

You can install Delphinus package manager and install LoggerPro as a package there. (Delphinus-Support)

下载源码

通过命令行克隆项目:

git clone https://github.com/danieleteti/loggerpro.git

收藏 (0) 打赏

感谢您的支持,我会继续努力的!

打开微信/支付宝扫一扫,即可进行扫码打赏哦,分享从这里开始,精彩与您同在
点赞 (0)

申明:本文由第三方发布,内容仅代表作者观点,与本网站无关。对本文以及其中全部或者部分内容的真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。本网发布或转载文章出于传递更多信息之目的,并不意味着赞同其观点或证实其描述,也不代表本网对其真实性负责。

左子网 编程相关 loggerpro https://www.zuozi.net/33669.html

discord drover
上一篇: discord drover
常见问题
  • 1、自动:拍下后,点击(下载)链接即可下载;2、手动:拍下后,联系卖家发放即可或者联系官方找开发者发货。
查看详情
  • 1、源码默认交易周期:手动发货商品为1-3天,并且用户付款金额将会进入平台担保直到交易完成或者3-7天即可发放,如遇纠纷无限期延长收款金额直至纠纷解决或者退款!;
查看详情
  • 1、描述:源码描述(含标题)与实际源码不一致的(例:货不对板); 2、演示:有演示站时,与实际源码小于95%一致的(但描述中有”不保证完全一样、有变化的可能性”类似显著声明的除外); 3、发货:不发货可无理由退款; 4、安装:免费提供安装服务的源码但卖家不履行的; 5、收费:价格虚标,额外收取其他费用的(但描述中有显著声明或双方交易前有商定的除外); 6、其他:如质量方面的硬性常规问题BUG等。 注:经核实符合上述任一,均支持退款,但卖家予以积极解决问题则除外。
查看详情
  • 1、左子会对双方交易的过程及交易商品的快照进行永久存档,以确保交易的真实、有效、安全! 2、左子无法对如“永久包更新”、“永久技术支持”等类似交易之后的商家承诺做担保,请买家自行鉴别; 3、在源码同时有网站演示与图片演示,且站演与图演不一致时,默认按图演作为纠纷评判依据(特别声明或有商定除外); 4、在没有”无任何正当退款依据”的前提下,商品写有”一旦售出,概不支持退款”等类似的声明,视为无效声明; 5、在未拍下前,双方在QQ上所商定的交易内容,亦可成为纠纷评判依据(商定与描述冲突时,商定为准); 6、因聊天记录可作为纠纷评判依据,故双方联系时,只与对方在左子上所留的QQ、手机号沟通,以防对方不承认自我承诺。 7、虽然交易产生纠纷的几率很小,但一定要保留如聊天记录、手机短信等这样的重要信息,以防产生纠纷时便于左子介入快速处理。
查看详情

相关文章

猜你喜欢
发表评论
暂无评论
官方客服团队

为您解决烦忧 - 24小时在线 专业服务