lumberjack 1.0.0-rc.1

  • Readme
  • Changelog
  • Example
  • Installing
  • 38

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 pub get

Alternatively, your editor might support pub get or flutter pub 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';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
0
Health:
Code health derived from static analysis. [more]
78
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
75
Overall:
Weighted score of the above. [more]
38
Learn more about scoring.

We analyzed this package on Jan 20, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.7.0
  • pana: 0.13.4

Health suggestions

Fix lib/io.dart. (-8.17 points)

Analysis of lib/io.dart reported 17 hints, including:

line 30 col 27: Unnecessary new keyword.

line 42 col 7: Unnecessary new keyword.

line 51 col 7: DO use curly braces for all flow control structures.

line 53 col 7: DO use curly braces for all flow control structures.

line 55 col 7: DO use curly braces for all flow control structures.

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

Analysis of lib/logging.dart reported 9 hints, including:

line 18 col 7: DO use curly braces for all flow control structures.

line 20 col 7: DO use curly braces for all flow control structures.

line 25 col 7: DO use curly braces for all flow control structures.

line 27 col 7: DO use curly braces for all flow control structures.

line 29 col 7: DO use curly braces for all flow control structures.

Fix lib/src/log_severity.dart. (-3.93 points)

Analysis of lib/src/log_severity.dart reported 8 hints, including:

line 11 col 40: Avoid const keyword.

line 14 col 36: Avoid const keyword.

line 17 col 39: Avoid const keyword.

line 20 col 36: Avoid const keyword.

line 23 col 38: Avoid const keyword.

Fix additional 5 files with analysis or formatting issues. (-7.42 points)

Additional issues in the following files:

  • lib/src/hierarchical_logger.dart (7 hints)
  • lib/src/string_sink.dart (5 hints)
  • lib/src/logger.dart (3 hints)
  • lib/lumberjack.dart (Run dartfmt to format lib/lumberjack.dart.)
  • lib/src/log.dart (Run dartfmt to format lib/src/log.dart.)

Maintenance issues and suggestions

Support latest dependencies. (-10 points)

The version constraint in pubspec.yaml does not support the latest published versions for 1 dependency (intl).

Package is getting outdated. (-10.14 points)

The package was last published 57 weeks ago.

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 0.16.1
io ^0.3.2 0.3.3
logging ^0.11.0 0.11.4
meta ^1.0.0 1.1.8
quiver_hashcode ^2.0.0 2.0.0
Transitive dependencies
charcode 1.1.2
collection 1.14.12
path 1.6.4
source_span 1.6.0
string_scanner 1.0.5
term_glyph 1.1.0
Dev dependencies
pedantic ^1.0.0
test ^1.0.0