Flexible Simple Logger

My old (decades) logger had become unwieldy and there was some doubt in mind if I still owned all the code. So, I wrote a new one, very simple, very flexible and thread safe. It’s free if someone wants to use it or expand on it.

[PBS Delphi Logger](PBS Delphi Logger - Thread-safe logging with multiple outputs)

Simple Thread-Safe Logging for Delphi
A lightweight, thread-safe logging system for Delphi applications. Write log messages to multiple outputs simultaneously - files, console, or GUI memos. Uses a singleton pattern so you can log from anywhere in your code without passing logger instances around.

Key Features

  • Thread-safe via critical sections - safe to use from multiple threads
  • Multiple output targets - file, console, TMemo (or create your own)
  • Singleton pattern - use anywhere without initialization
  • Daily rotating log files with configurable naming
  • Auto-closes files after 5 seconds of inactivity (saves file handles)
  • Optional class/method context tracking
  • Exception logging with formatted error blocks
  • Precise timestamps with millisecond accuracy
  • Automatic log directory creation and validation
3 Likes