bwu_log 0.1.2

  • README.md
  • CHANGELOG.md
  • Installing
  • Versions
  • 0

BWU Log

BWU Log is a fork of Quiver log. It is a set of logging utilities that make it easy to configure and manage Dart's built in logging capabilities.

The Basics

Dart's built-in logging utilities are fairly low level. This means each time you start a new project you have to copy/paste a bunch of logging configuration code to setup output locations and logging formats. BWU Log provides a set of higher-level abstractions to make it easier to get logging setup correctly. Specifically, there are two new concepts: appender and formatter. Appenders define output locations like the console, http or even in-memory data structures that can store logs. Formatters, as the name implies, allow for custom logging formats.

Here is a simple example that sets up a InMemoryAppender with a SimpleStringFormatter:

import 'package:logging/logging.dart';
import 'package:bwu_log/log.dart';

class SimpleStringFormatter implements FormatterBase<String> {
  String call(LogRecord record) => record.message;
}

main() {
  var logger = new Logger('bwu.TestLogger');
  var appender = new InMemoryListAppender(new SimpleStringFormatter());
  appender.attachLogger(logger);
}

That's all there is to it!

BWU Log provides three Appenders: PrintAppender which uses Dart's print statement to write to the console, InMemoryListAppender which writes logs to a simple list (this can be useful for debugging or testing). Additionally, a single Formatter called BasicLogFormatter is included and uses a "MMyy HH:mm:ss.S" format. Of course there is no limit to what kind of appenders you can create, we have plans to add appenders HTTP, WebSocket, DOM, Isolate and SysOut.

To create a new kind of Appender simply extends Appender. To create a new Formatter just implement the Formatter typedef or FormatterBase class if you need to hold state in your formatter. Take a look at PrintAppender and BasicLogFormatter for an example.

0.1.1

  • add simple default initialization for the PrintAppender with setup_print_appender.dart

0.1.0

  • remove Polymer component and dependency
  • upgrade dependencies

Use this package as a library

1. Depend on it

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


dependencies:
  bwu_log: ^0.1.2

2. Install it

You can install packages from the command line:

with pub:


$ pub get

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

3. Import it

Now in your Dart code, you can use:


import 'package:bwu_log/bwu_log.dart';
  
Version Uploaded Documentation Archive
0.1.2 Apr 25, 2016 Go to the documentation of bwu_log 0.1.2 Download bwu_log 0.1.2 archive
0.1.1 Apr 25, 2016 Go to the documentation of bwu_log 0.1.1 Download bwu_log 0.1.1 archive
0.1.0 Apr 11, 2016 Go to the documentation of bwu_log 0.1.0 Download bwu_log 0.1.0 archive
2.0.0-alpha.2 Feb 14, 2017 Go to the documentation of bwu_log 2.0.0-alpha.2 Download bwu_log 2.0.0-alpha.2 archive
2.0.0-alpha.1 Feb 13, 2017 Go to the documentation of bwu_log 2.0.0-alpha.1 Download bwu_log 2.0.0-alpha.1 archive
2.0.0-alpha.0 Feb 13, 2017 Go to the documentation of bwu_log 2.0.0-alpha.0 Download bwu_log 2.0.0-alpha.0 archive
Popularity:
Describes how popular the package is relative to other packages. [more]
0
Health:
Code health derived from static analysis. [more]
0
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
0
Overall:
Weighted score of the above. [more]
0
Learn more about scoring.

The package version is not analyzed, because it does not support Dart 2. Until this is resolved, the package will receive a health and maintenance score of 0.

Issues and suggestions

Support Dart 2 in pubspec.yaml.

The SDK constraint in pubspec.yaml doesn't allow the Dart 2.0.0 release. For information about upgrading it to be Dart 2 compatible, please see https://www.dartlang.org/dart-2#migration.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=1.12.0 <2.0.0