Skip to content

Releases: omonien/DX.Logger

DX.Logger 1.1.0

15 Apr 10:20

Choose a tag to compare

Highlights

  • Cross-platform memory-pressure info, ready to use. A new DX.Logger.MemoryInfo unit ships with EnableMemoryInfo — a single call that attaches [WS:45MB PB:22MB]-style snippets to every log entry. Platform coverage: Windows, macOS/iOS, Linux/Android. Unsupported platforms fall back to an empty snapshot, logging keeps running.
  • First-class thread-id everywhere. TUILogProvider and TDefaultLogProvider now render [Thread:N] just like the File and Seq providers did already. Live UI logs finally tell you which request produced which line.
  • Consistent log line format across all standard providers:
    [timestamp] [LEVEL] [Thread:N] optionally followed by [MemoryInfo], then the message.

Added

  • TLogEntry.MemoryInfo — optional free-form string filled by TDXLogger when a host registers TDXLogger.Instance.MemoryInfoCallback. The Seq provider exposes it as a structured JSON field so you can filter and chart on it.
  • DX.Logger.MemoryInfo unit: cached TProcessMemoryMonitor (default 500 ms), cross-platform. EnableMemoryInfo / DisableMemoryInfo for the common case, direct callback access for full control.
  • Thread-ID rendering in TUILogProvider (main + TRACE line) and TDefaultLogProvider.

Changed

  • Log line layout unified across standard providers. Custom providers that format entries from AEntry.Message keep working unchanged.

Fixed

  • TFileLogProvider silently dropped batches when the file was briefly held by another thread or process (old code had a swallow-everything except). Replaced with a 10×5 ms retry loop. If all retries fail, the drop is reported via OutputDebugString (Windows) / stderr (other platforms) so the failure is visible — never recursing back into the logger.
  • TFileLogProvider.SetLogFileName now flushes pending writes against the previous filename before switching. Prevents log entries from bleeding between files when the host changes the log target while the async worker is mid-batch.
  • TAsyncLogProvider.Flush now waits for true drain (queue empty and in-flight batch written) using an interlocked counter, instead of just polling QueueSize. Previously a flush could return while the worker was still inside WriteBatch, losing a few entries to a race between Flush and a subsequent Delete/rotation.

Tests

13 new tests covering the memory-info feature, plus a fix to the legacy thread-safety test (closure over the for-loop variable made all workers share an index). With the fixes above, the full suite is now 41/41 green and stable across consecutive runs (verified 5×) on Delphi 10.3 / Win32.

Upgrade Notes

Fully backward compatible. If you do not install a memory-info callback, output looks exactly like 1.0 — plus the new `[Thread:N]` segment in UI and default providers.

To opt into memory info:

```pascal
uses
DX.Logger,
DX.Logger.MemoryInfo;

begin
EnableMemoryInfo;
...
end.
```

See the README for the full story.

Full changelog: v1.0.0...v1.1.0

v1.0.0 - Initial Public Release

18 Nov 16:24

Choose a tag to compare

DX.Logger v1.0.0 - Initial Public Release

🎉 First stable release of DX.Logger - A minimalistic, cross-platform logging library for Delphi!

✨ Highlights

  • Simple API: Just add DX.Logger to your uses clause and call DXLog()
  • Cross-Platform: Windows, macOS, iOS, Android, Linux
  • Extensible: Provider-based architecture for custom log targets
  • Production-Ready: Comprehensive unit tests (25 tests, all passing)
  • Secure: Built-in configuration management for sensitive credentials

📦 Core Features

Logging Functionality

  • Multiple log levels: Trace, Debug, Info, Warn, Error
  • Platform-specific output mechanisms:
    • Console apps: WriteLn
    • Windows: OutputDebugString
    • iOS/macOS: NSLog
    • Android: Android system log
    • Linux: syslog
  • Thread-safe logging
  • Configurable minimum log level
  • Simple API with convenience functions

Providers

File Provider

  • Automatic file rotation based on size
  • Configurable file name and maximum size
  • Thread-safe file writing

Seq Provider

  • Structured logging to Seq servers
  • Asynchronous, non-blocking logging
  • Automatic batching for performance
  • CLEF (Compact Log Event Format) support
  • Configurable batch size and flush interval
  • Thread-safe queue-based processing

🔒 Security

  • Secure credential management with config.local.ini
  • Configuration template system (config.example.ini)
  • All sensitive data excluded from version control
  • Comprehensive security documentation
  • No hardcoded secrets in codebase

📚 Documentation

  • Comprehensive README with examples
  • Technical documentation for configuration and Seq provider
  • Security best practices guide
  • Contribution guidelines
  • Complete API documentation in source code

🧪 Testing

  • 25 comprehensive unit tests using DUnitX
  • Tests cover:
    • Provider creation and configuration
    • Log entry processing
    • CLEF format generation
    • Log level mapping
    • Asynchronous logging
    • Batching functionality
    • Thread safety (500 concurrent messages)
    • Shutdown behavior

📋 Requirements

  • Delphi 10.3 Rio or later
  • Supported platforms: Windows, macOS, iOS, Android, Linux

🚀 Installation

Manual Installation

  1. Download and extract the release
  2. Add the source directory to your Delphi library path
  3. Add DX.Logger to your uses clause

Git Submodule

git submodule add https://github.com/omonien/DX.Logger.git

📖 Quick Start

uses
  DX.Logger;

begin
  DXLog('Hello World');                    // Info level
  DXLog('Debug message', TLogLevel.Debug); // Debug level
  DXLogError('Something went wrong!');     // Error level
end;

🔗 Links

📄 License

MIT License - see LICENSE.md

🙏 Acknowledgments

Thanks to the Delphi community for inspiration and feedback!


Full Changelog: https://github.com/omonien/DX.Logger/blob/master/CHANGELOG.md