Migrated pretty_logging to nndb
This commit is contained in:
parent
2014c95105
commit
1db6b35fb3
2 changed files with 9 additions and 9 deletions
|
@ -8,24 +8,24 @@ import 'package:io/ansi.dart';
|
|||
///
|
||||
/// You can also pass a custom [printFunction] or [logColorChooser].
|
||||
void prettyLog(LogRecord record,
|
||||
{bool Function(LogRecord) omitError,
|
||||
void Function(String) printFunction,
|
||||
AnsiCode Function(Level) logColorChooser}) {
|
||||
{bool Function(LogRecord)? omitError,
|
||||
void Function(String)? printFunction,
|
||||
AnsiCode Function(Level)? logColorChooser}) {
|
||||
logColorChooser ??= chooseLogColor;
|
||||
omitError ??= (_) => false;
|
||||
printFunction ??= print;
|
||||
|
||||
var code = logColorChooser(record.level);
|
||||
if (record.error == null) printFunction(code.wrap(record.toString()));
|
||||
if (record.error == null) printFunction(code.wrap(record.toString())!);
|
||||
|
||||
if (record.error != null) {
|
||||
var err = record.error;
|
||||
if (omitError(record)) return;
|
||||
printFunction(code.wrap(record.toString() + '\n'));
|
||||
printFunction(code.wrap(err.toString()));
|
||||
printFunction(code.wrap(record.toString() + '\n')!);
|
||||
printFunction(code.wrap(err.toString())!);
|
||||
|
||||
if (record.stackTrace != null) {
|
||||
printFunction(code.wrap(record.stackTrace.toString()));
|
||||
printFunction(code.wrap(record.stackTrace.toString())!);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
name: pretty_logging
|
||||
version: 2.0.0
|
||||
version: 2.1.0
|
||||
description: Standalone helper for colorful logging output, using pkg:io AnsiCode.
|
||||
author: Tobe Osakwe <thosakwe@gmail.com>
|
||||
homepage: https://github.com/angel-dart/pretty_logging
|
||||
environment:
|
||||
sdk: ">=2.10.0 <3.0.0"
|
||||
sdk: '>=2.12.0 <3.0.0'
|
||||
dependencies:
|
||||
io: ^1.0.0
|
||||
logging: ^1.0.0
|
||||
|
|
Loading…
Reference in a new issue