logger_rs 2.0.2
logger_rs: ^2.0.2 copied to clipboard
A beautiful Rust-style logger for Dart with colored output, precise file locations, tag-based logging for AI analysis, and clean formatting inspired by the Rust compiler.
Changelog #
All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
2.0.2 - 2026-02-01 #
Changed #
- Complete README rewrite - Cleaner, more concise documentation
- Reduced README from ~420 lines to ~150 lines (65% smaller)
- Reorganized structure: Quick Start first, advanced features later
- Tag logging moved to "Advanced" section instead of dominating the document
- Simplified tables and removed redundant examples
- Better balance between basic usage and advanced features
2.0.1 - 2026-01-30 #
Added #
Log.export(name, export: bool)- New parameter to conditionally enable/disable export based on custom logicLog.exportAll(export: bool)- Same parameter for batch export
Performance Optimizations #
Major performance improvements reducing log operation time by ~40-50%:
LocationResolver Optimizations
- Early return pattern in
_shouldIgnoreLine()- ReplacedList.any()with inline checks and early returns - Pattern ordering by frequency - Most common patterns checked first for faster short-circuiting
- Eliminated closure allocation - Removes per-call closure creation overhead
Single StackTrace Capture
Log.tag()now captures stack once - Eliminated redundantStackTrace.currentcalls- New
_logWithLocation()method - Internal method that accepts pre-resolved location - ~15-25μs saved per tagged log operation
ObjectFormatter Fast Path
- Fast path for simple Maps - Maps with ≤3 entries and no nesting bypass JsonEncoder
- Direct string formatting - Avoids encoder overhead for simple cases
- ~5-25μs saved for simple map operations
LogFormatter Cache
- Multiline check cached -
contains('\n')evaluated once per format operation - Variable reuse - Eliminates redundant string scans
Performance Results #
| Operation | Before | After | Improvement |
|---|---|---|---|
| Simple tag | ~25μs | ~17μs | ~32% faster |
| Map tag | ~35μs | ~24μs | ~31% faster |
| Error tag | ~35μs | ~27μs | ~23% faster |
2.0.0 - 2026-01-30 #
Added #
Tag Logging System for AI Analysis
Log.tag(name, message)- Group related logs across layers with tagsLog.export(name)- Export tagged logs as Markdown to consoleLog.export(name, onlyOnError: true)- Conditional export only when errors occurLog.exportAll()- Export all tags at onceLog.clear(name)- Clear a tag without exportingLog.clearAll()- Clear all tagsLog.hasTag(name)- Check if a tag existsLog.hasErrors(name)- Check if a tag has error entriesLog.entryCount(name)- Get entry count for a tag
Auto Stack Trace Capture
- Automatic stack trace capture for WARNING, ERROR, and CRITICAL levels
- No need to manually pass
StackTrace.currentfor error logs
Markdown Export Format
- Clean Markdown output optimized for AI analysis (Claude, ChatGPT, etc.)
- Visual separators for easy copy-paste
- JSON syntax highlighting for Map objects
- Collapsible stack traces using HTML details tags
- Summary section with entry counts by level
- Timeline section with timestamps and source locations
New Export Module
lib/src/export/tagged_entry.dart- Entry model for tagged logslib/src/export/md_formatter.dart- Markdown formatter for AI-friendly output
Changed #
- Improved documentation with comprehensive examples
- Better code organization with section separators
- Enhanced docstrings for all public methods
Technical Details #
- Zero overhead in release builds (tag storage code is removed by compiler)
- No file I/O - exports to console for universal compatibility
- Works with Flutter, Dart VM, Web, and all platforms
1.0.4 #
- Remove dart:io for
jasprsupport
1.0.3 #
WARNINGin capital letters
1.0.2 #
Added #
- Full Web platform support with conditional imports
- WASM runtime compatibility
- Support for all 6 Dart platforms (Android, iOS, Windows, macOS, Linux, Web)
Changed #
- Replaced
dart:ioimports with conditional platform abstraction - Improved cross-platform console output handling
- Enhanced Web browser console integration
Fixed #
- Web platform compatibility issue that prevented deployment
- WASM runtime compatibility for future-proofing
- Platform detection now works correctly across all environments
Technical Details #
- Implemented conditional imports for platform-specific code
- Added platform abstraction layer (
platform_io.dart,platform_web.dart,platform_stub.dart) - Ensured ANSI color codes work seamlessly on Web platforms
- Removed direct
dart:iodependency from main logger code
1.0.1 #
1.0.0 - 2025-01-14 #
Added #
- Initial release of Logger RS
- Rust-style formatted output with beautiful colors
- Support for multiple log levels: Trace, Debug, Info, Warning, Error, Critical
- Precise file location tracking (file:line:column)
- ANSI color support for terminals
- Stack trace support for error logging
- Zero-configuration setup
- Cross-platform support (Flutter, Dart VM, Dart Native)
- High-performance logging with minimal overhead
- Custom object logging support
- Comprehensive test suite
- Complete documentation and examples
Features #
Log.t()- Trace level logging (most verbose)Log.d()- Debug level loggingLog.i()- Info level loggingLog.w()- Warning level loggingLog.e()- Error level logging with optional stack tracesLog.f()- Critical/Fatal level logging
Technical Details #
- Built on top of the
loggingpackage for reliability - Smart platform detection for color support
- Automatic caller location extraction from stack traces
- Clean and readable Rust-inspired formatting