lumberjack 1.0.0-rc.1

  • Readme
  • Changelog
  • Example
  • Installing
  • 44

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]
90
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
85
Overall:
Weighted score of the above. [more]
44
Learn more about scoring.

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

  • Dart: 2.5.1
  • pana: 0.12.21

Platforms

Detected platforms: Flutter, web, other

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

Health suggestions

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

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

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.

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

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

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

Analysis of lib/logging.dart reported 7 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/logger.dart. (-0.50 points)

Analysis of lib/src/logger.dart reported 1 hint:

line 68 col 11: DO use curly braces for all flow control structures.

Fix additional 3 files with analysis or formatting issues. (-0.50 points)

Additional issues in the following files:

  • lib/src/string_sink.dart (1 hint)
  • 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 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.0
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.4
source_span 1.5.5
string_scanner 1.0.5
term_glyph 1.1.0
Dev dependencies
pedantic ^1.0.0
test ^1.0.0