lumberjack 1.0.0-rc.1

  • README.md
  • CHANGELOG.md
  • Example
  • Installing
  • Versions
  • 49

lumberjack #

Improved hierarchical logging for Dart.

// Simple usage
var logger = Logger('example');
logger.informational('Hey!!!');

// Hierarchy
var baz = logger.createChild('bar').createChild('baz');
baz.notice('example.foo.bar.baz');

// Intercept print, errors.
logger.runZoned(() async {
    await doSomething();
}, onError: () => 34);

logger.error('...', e, st);

// Printing (with colors)
logger.pipe(AnsiLogPrinter.toStdout());
logger.pipe(StringSinkLogPrinter(myStringBuffer));

// Patch over package:logging
var converter = ConvertingLogger(oldLogger);
converter.error('...');
oldLogger.severe('...');

await for (var log in logger) {
    // ... Do something...
}

1.0.0-rc.1 #

  • ConvertingLogger will emit log events into the child logger as well.

1.0.0-rc.0 #

example/main.dart

// ignore_for_file: unawaited_futures
import 'package:lumberjack/lumberjack.dart';
import 'package:lumberjack/io.dart';

main() async {
  var logger = new Logger('example');
  var foo = logger.createChild('foo');

  var printer = new AnsiLogPrinter.toStdout();

  printer.addStream(logger);

  foo.runZoned(
    () async {
      Logger.current
        ..emergency('Nooo! It\'s THREE!!!')
        ..notice('Wait, it\'s actually okay.')
        ..debug('Ok...')
        ..warning('Don\'t do that!!! At least, not yet...');

      print('Calls to print are captured, too!');

      throw new StateError('Errors are logged, too.');
    },
    onError: () => print('caught error...'),
  );

  foo.createChild('bar').createChild('baz').notice('Hooray!');

  await logger.done;
}

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  lumberjack: ^1.0.0-rc.1

2. Install it

You can install packages from the command line:

with pub:


$ pub get

with Flutter:


$ flutter packages get

Alternatively, your editor might support pub get or flutter packages get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:lumberjack/lumberjack.dart';
  
Version Uploaded Documentation Archive
1.0.0-rc.1 Dec 13, 2018 Go to the documentation of lumberjack 1.0.0-rc.1 Download lumberjack 1.0.0-rc.1 archive
1.0.0-rc.0 Dec 11, 2018 Go to the documentation of lumberjack 1.0.0-rc.0 Download lumberjack 1.0.0-rc.0 archive
Popularity:
Describes how popular the package is relative to other packages. [more]
0
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
95
Overall:
Weighted score of the above. [more]
49
Learn more about scoring.

We analyzed this package on Apr 12, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.2.0
  • pana: 0.12.14

Platforms

Detected platforms: Flutter, web, other

No platform restriction found in primary library package:lumberjack/lumberjack.dart.

Health suggestions

Fix lib/logging.dart. (-0.50 points)

Analysis of lib/logging.dart reported 1 hint:

line 53 col 3: The class 'Future' was not exported from 'dart:core' until version 2.1, but this code is required to be able to run on earlier versions.

Format lib/lumberjack.dart.

Run dartfmt to format lib/lumberjack.dart.

Format lib/src/log.dart.

Run dartfmt to format lib/src/log.dart.

Maintenance suggestions

Package is pre-release. (-5 points)

Pre-release versions should be used with caution; their API can change in breaking ways.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0-dev <3.0.0
intl ^0.15.7 0.15.8
io ^0.3.2 0.3.3
logging ^0.11.0 0.11.3+2
meta ^1.0.0 1.1.7
quiver_hashcode ^2.0.0 2.0.0
Transitive dependencies
charcode 1.1.2
path 1.6.2
source_span 1.5.5
string_scanner 1.0.4
term_glyph 1.1.0
Dev dependencies
pedantic ^1.0.0
test ^1.0.0