omni_logger 1.0.5
omni_logger: ^1.0.5 copied to clipboard
Omni Logger is a production-ready logging package for Flutter with auto-configuration, file rotation, isolate support, and build mode optimization.
đ Omni Logger #
Production-ready logging for Flutter with auto-configuration and file management.
Built on the trusted logger package with production-ready enhancements and intelligent auto-configuration.
⥠Quick Start #
1. Add Dependency #
dependencies:
omni_logger: ^1.0.0
2. Setup & Use #
import 'package:omni_logger/omni_logger.dart';
Future<void> main() async {
WidgetsFlutterBinding.ensureInitialized();
AppLog.setup();
runApp(const MyApp());
}
// Use anywhere in your app
AppLog.log('Auth').i('User login successful');
AppLog.log('Payment').e('Payment failed');
AppLog.log('Database').d('Query executed');
Table of Contents #
- Why Omni Logger?
- Smart Auto-Configuration
- Logging Levels
- Isolate Support
- Advanced Features
- Platform Support
đ¯ Why Omni Logger? #
Most Flutter apps start with print() or debugPrint(), then face these challenges:
- đą No persistence â Debug info disappears when the app closes
- đ Poor production visibility â Can't diagnose user-reported issues
- ⥠Performance impact â Verbose logging slowing down production builds
- đ§ Manual setup â File rotation, compression, cleanup all manual
| Challenge | Omni Logger | Traditional |
|---|---|---|
| Setup | â
AppLog.setup() â zero config |
â Manual configuration |
| File Management | â Auto rotation, compression, cleanup | â Manual FileOutput setup |
| Build Optimization | â Auto-adapts to debug/release modes | â Same config for all builds |
| Production Debugging | â Persistent logs | â No production logging |
đ§ Smart Auto-Configuration #
Omni Logger automatically optimizes based on your Flutter build mode:
| Build Mode | Log Level | Files | Size Each | Retention | Console |
|---|---|---|---|---|---|
| Debug | DEBUG | 3 files | 5MB | 3 days | â |
| Profile | WARNING | 2 files | 3MB | 2 days | â |
| Release | ERROR | 1 file | 1MB | 1 day | â |
đ Logging Levels #
AppLog.log('ClassName').t('Trace message'); // đ Trace
AppLog.log('ClassName').d('Debug message'); // đ Debug
AppLog.log('ClassName').i('Info message'); // âšī¸ Info
AppLog.log('ClassName').w('Warning message'); // â ī¸ Warning
AppLog.log('ClassName').e('Error message'); // â Error
AppLog.log('ClassName').f('Fatal message'); // đ Fatal
đ Isolate Support #
// Database isolate (Drift, etc.)
AppLog.setupForDatabaseIsolate(isolateName: 'drift_db');
AppLog.log('Database').d('Query executed successfully');
// Background isolate
AppLog.setupForBackgroundIsolate(isolateName: 'sync_worker');
AppLog.log('SyncService').w('Sync took longer than expected');
đ§ Advanced Features #
Setup Options #
AppLog.setup(); // Auto-detect environment
AppLog.setupDevelopment(); // Debug mode with clean logs
AppLog.setupProduction(); // Minimal logging
AppLog.setupOff(); // Disable all logging
Runtime Control #
AppLog.cleanAllLogs(); // Clean all log files
AppLog.printLogStats(); // Print log statistics
AppLog.checkHealth(); // Get health status
AppLog.reset(); // Reset logger
AppLog.isSetup; // Check if initialized
AppLog.currentLevel; // Get current log level
AppLog.isLoggingDisabled; // Check if logging is off
đą Platform Support #
| Platform | Console | File Logging |
|---|---|---|
| Android | â | â |
| iOS | â | â |
| macOS | â | â |
| Windows | â | â |
| Linux | â | â |
| Web | â | â (by design) |
Contributing #
Contributions are welcome! Please submit pull requests to our repository.
License #
MIT License â see LICENSE for details.
Platform Support: â Android, iOS, macOS, Windows, Linux | đ Web (console only)
Built with â¤ī¸ for the Flutter community