MultiLog

From Lazarus wiki
Jump to: navigation, search

English (en) français (fr)

About

MultiLog is a log system that aims at flexibility and low overhead at the same time. As the name suggests, it can be used to log to several targets such as a text file, a visual control or to another application. Adding new targets is as easy as creating a class that implements two methods, one being optional.

MultiLog is in general similar to CodeSite, Smart Inspect, Overseer and EstLogger but it does not follow closely any of them, implementing many things differently and, even, having some unique features.

Starting from version 0.5, the base library can be compiled with Delphi.

Features:

  • Flexible:
    • It's possible to define up to 32 log classes and enable/disable any combination of them
    • Each message can be associated with more than one class
    • There's overloaded functions for most used types: Integer, Float, Boolean, String, TStrings, TRect, TPoint
  • Low overhead:
    • If a log class is not active, all messages that belongs to it only do a check in the begin of the function and exit
    • In the future a fake TLogger class will be provided, so the overhead will be even smaller if desired
  • Main features found in the cited Log Systems are implemented:
    • SendException
    • Watches
    • Named Counters
    • Send TObject/TComponent, TBitmap, Memory info
    • A log viewer application (MultiLog Viewer) with ability to track watches, callstack and filter messages
  • Unique:
    • Implements conditional messages (using SendIf method): a message is sent if a boolean criterium is met
    • Implements a function (CalledBy) that returns if the current code was called by a method (Useful to debug the LCL)
    • Implements SendCallStack and SendHeapInfo: the name says it all
    • Named CheckPoints
    • Ability to send custom messages through callback functions


Here's the provided Log Viewer in action:

Multilogviewer.png

Author

Luiz Américo Pereira Câmara aka Karl Brandt

Contact: pascalive at bol(dot)com(dot)br

License

Modified LGPL

Download

Multilog 0.5 and Multilog Viewer 0.3 LuiPack/BountySource or Lazarus CCR

Most recent: https://github.com/blikblum/multilog

Change Log

  • 22/07/13
    • MultiLog 0.6
      • Improve compatibility with recent versions of Lazarus/LCL
      • Improve TObject/TComponent streaming
  • 29/03/08
    • MultiLog 0.5
      • Can be compiled with Delphi
      • Enable inline
      • Several fixes
    • MultiLog Viewer 0.3
      • Added ability to see a watch history
      • Improved GUI usability
  • 19/05/2007 - MultiLog 0.4
    • Changed license to modified LGPL
    • Added named counters
    • A message can be associated with more than one class
  • 11/02/2007 - Multilog 0.3/Multilog Viewer 0.2
    • Multilog
      • Added SendCustomData, SendMemory methods
      • Added a TLogger descendant (TLCLLogger) which can send LCL specific data (TBitmap for now)
      • Cleaned the code
    • Multilog Viewer
      • Ability to display a memory area as hex values
      • Ability to display bitmaps
      • Improved usability
  • 06/08/2006 - Multilog 0.2
    • Implemented overloaded Send method for TObject and Float
    • Implemented Watches
    • Implemented CheckPoints
    • Implemented SendHeapInfo and SendException
    • Created a full LogViewer (MultiLog Viewer 0.1) with support for Watches, CallStack and message filtering
  • 12/06/2006 - Multilog 0.1
    • Initial release

System Requirements

Usage

  • Some usage examples can be found here
  • See the examples included in the demos folder

Known Issues

  • In my setup (Lazarus 0.9.17 + fpc 2.0.4rc2 + Windows XP), is necessary add the directory where is the package sources to the Units path in the Compiler Options. This occurs, i think, because fpc tries to recompile a unit even after finding it in $(PkgDir)\lib\$(TargetCPU)-$(TargetOS)\. It seems a fpc bug since sometimes a Internal Error is given
    • To override this problem since version 0.2 the unit path of the lazarus package points to $(PkgDir). This has the drawback of breaking the "multienviroment" schema that separates binaries of different targets used in most packages.
      • As a side effect when compiling projects that requires multilog package, fpc will create duplicated units in the project path and Lazarus IDE warn about them. Just ignore the warnings.
  • While developing MultiLog i had some problems with inlines (See this bug). All inlines were commented. Because of this all calls to the overloaded SendCallStack that has a implicit classes (DefaultClasses) will have SENDCALLSTACK as the first frame. Use the explicit SendCallStack overloaded function as a workaround.
    • Waiting for fpc2.2 to re-enable inline.

See also