Just another library for logging.
A little bit based on Timber library.
Unfortunately, colors does not work for iPhone devices, so it is disabled only for iOS.
Features
- show logs friendly using tags with call location, colors and emoji;
- open to implement your custom log output;
- written on top of logging library.
Getting started
Add dependency to project:
dart pub add logify
Usage
// Import the package
import 'package:logify/logify.dart';
void main() {
// In the main file or entrypoint add a recorder just once
Log.listen(ConsoleLogRecorder());
// Now, you can start using
Log.i('info message');
}
You can also integrate with logging library:
import 'package:logify/logify.dart';
import 'package:logging/logging.dart';
void main() {
// Change the logging level
Logger.root.level = Level.ALL; // defaults to Level.INFO
// Add a recorder
Logger.root.onRecord.listen(DebugLogRecorder());
// Now, you can start using
Log.i('info message');
}
All other packages that use logging will also be handled by DebugLogRecorder
.
For more details, see the example project and the logging library documentation.
LogRecorder
ConsoleLogRecorder
Log.listen(ConsoleLogRecorder());
Output:
DebugLogRecorder
Log.listen(DebugLogRecorder());
Output: