logging_colorful 1.2.1 logging_colorful: ^1.2.1 copied to clipboard
Logging package with colors, no external dependencies.
logging_colorful #
I'm using the logging package and i wanted it to be colorful. When I searched for this, I found packages with way too much features and dependencies.
So I created this package with no other dependencies than the necessary logging.
If you don't want to import this package, you can take the two files in lib/src
.
Features #
- Colorful logging
- Change color for each Level
Limitations #
log.disabledColors = Platform.isIOS;
Usage #
import 'dart:io';
import 'package:logging_colorful/logging_colorful.dart';
void main() {
// Define your Logger configuration
Logger.root.level = Level.ALL;
Logger.root.onRecord.listen((record) {
print('${record.loggerName} - ${record.level.name}: ${record.message}');
});
// Initialize a LoggerColorful that will make your logger colorized
// You can disable colors
// May be useful for iOS users, since iOS doesn't render ANSI Colors (escaped)
final log = LoggerColorful('MyLogger', disabledColors: Platform.isIOS);
log.shout('shout');
log.severe('severe');
log.warning('warning');
log.info('info');
log.config('config');
log.fine('fine');
log.finer('finer');
log.finest('finest');
// Change the Color for a Level
log.colorLevel[Level.FINEST] = AnsiColor.rainbow;
log.finest('finest with rainbow of color');
}
Screenshots #
Additional information #
All the available colors are listed in lib/src/color.dart
file.