logging_colorful 1.0.0 copy "logging_colorful: ^1.0.0" to clipboard
logging_colorful: ^1.0.0 copied to clipboard

Logging package with colors, no external dependencies.

example/logging_colorful_example.dart

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 Logger
  var log = Logger('MyLogger');
  log.info('parent logger is not colorized');

// Initialize a LoggerColorful that will make your logger colorized
  final colorLog = LoggerColorful(log);
  colorLog.shout('shout');
  colorLog.severe('severe');
  colorLog.warning('warning');
  colorLog.info('info');
  colorLog.config('config');
  colorLog.fine('fine');
  colorLog.finer('finer');
  colorLog.finest('finest');

  // Change the Color for a Level
  // (In this case we assign an AnsiColor to [Level.FINEST] which has no AnsiColor to remove the rainbow)
  colorLog.colorLevel[Level.FINEST] = AnsiColor.backgroundGreen;
  colorLog.finest('finest with color instead of rainbow');
}
3
likes
0
pub points
68%
popularity

Publisher

verified publisherethicnology.com

Logging package with colors, no external dependencies.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

logging

More

Packages that depend on logging_colorful