Releases: omonien/DX.Logger
DX.Logger 1.1.0
Highlights
- Cross-platform memory-pressure info, ready to use. A new
DX.Logger.MemoryInfounit ships withEnableMemoryInfo— 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.
TUILogProviderandTDefaultLogProvidernow 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 byTDXLoggerwhen a host registersTDXLogger.Instance.MemoryInfoCallback. The Seq provider exposes it as a structured JSON field so you can filter and chart on it.DX.Logger.MemoryInfounit: cachedTProcessMemoryMonitor(default 500 ms), cross-platform.EnableMemoryInfo/DisableMemoryInfofor the common case, direct callback access for full control.- Thread-ID rendering in
TUILogProvider(main + TRACE line) andTDefaultLogProvider.
Changed
- Log line layout unified across standard providers. Custom providers that format entries from
AEntry.Messagekeep working unchanged.
Fixed
TFileLogProvidersilently dropped batches when the file was briefly held by another thread or process (old code had a swallow-everythingexcept). Replaced with a 10×5 ms retry loop. If all retries fail, the drop is reported viaOutputDebugString(Windows) / stderr (other platforms) so the failure is visible — never recursing back into the logger.TFileLogProvider.SetLogFileNamenow 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.Flushnow waits for true drain (queue empty and in-flight batch written) using an interlocked counter, instead of just pollingQueueSize. Previously a flush could return while the worker was still insideWriteBatch, losing a few entries to a race betweenFlushand a subsequentDelete/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
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.Loggerto your uses clause and callDXLog() - 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
- Console apps:
- 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
- Download and extract the release
- Add the
sourcedirectory to your Delphi library path - Add
DX.Loggerto 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
- Documentation
- Configuration Guide
- Seq Provider Documentation
- Security Policy
- Contributing Guidelines
- Changelog
📄 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