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.

License: LGPL v3 pub package

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

Usage #

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');
}

Additional information #

All the available colors are listed in lib/src/color.dart file.

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