platform/common/pretty_logging
2024-12-15 03:56:25 -07:00
..
example refactor: refactoring common utils, routes > routing, db drivers 2024-12-14 20:56:05 -07:00
lib refactor: refactoring common utils, routes > routing, db drivers 2024-12-14 20:56:05 -07:00
test refactor: refactoring common utils, routes > routing, db drivers 2024-12-14 20:56:05 -07:00
analysis_options.yaml refactor: refactoring common utils, routes > routing, db drivers 2024-12-14 20:56:05 -07:00
AUTHORS.md refactor: refactoring common utils, routes > routing, db drivers 2024-12-14 20:56:05 -07:00
CHANGELOG.md refactor: refactoring common utils, routes > routing, db drivers 2024-12-14 20:56:05 -07:00
LICENSE refactor: refactoring common utils, routes > routing, db drivers 2024-12-14 20:56:05 -07:00
pubspec.lock refactor: refactoring common utils, routes > routing, db drivers 2024-12-14 20:56:05 -07:00
pubspec.yaml refactor: refactoring common utils, routes > routing, db drivers 2024-12-14 20:56:05 -07:00
README.md refactor: refactoring common utilities 2024-12-15 03:56:25 -07:00

Belatuk Petty Logging

Pub Version (including pre-releases) Null Safety Gitter License

Replacement of package:pretty_logging with breaking changes to support NNBD.

Standalone helper for colorful logging output, using pkg:io AnsiCode.

Installation

In your pubspec.yaml:

dependencies:
  platform_pretty_logging: ^6.1.0

Usage

Basic usage is very simple:

myLogger.onRecord.listen(prettyLog);

However, you can conditionally pass logic to omit printing an error, provide colors, or to provide a custom print function:

var pretty = prettyLog(
  logColorChooser: (_) => red,
  printFunction: stderr.writeln,
  omitError: (r) {
    var err = r.error;
    return err is PlatformHttpException && err.statusCode != 500;
  },
);
myLogger.onRecord.listen(pretty);