quiver_log 1.0.5

  • README.md
  • Installing
  • Versions
  • 50

Quiver Log

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

Documentation

http://google.github.io/quiver-log/

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. Quiver-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:quiver_log/log.dart';

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

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

That's all there is to it!

Quiver-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) and a WebAppender which will take advantage of web console methods to improve readability in your browser. 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 formtatter. Take a look at PrintAppender and BasicLogFormatter for an example.

Use this package as a library

1. Depend on it

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


dependencies:
  quiver_log: ^1.0.5

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:quiver_log/log.dart';
import 'package:quiver_log/web.dart';
  
Version Uploaded Documentation Archive
1.0.5 May 9, 2016 Go to the documentation of quiver_log 1.0.5 Download quiver_log 1.0.5 archive
1.0.4 May 3, 2016 Go to the documentation of quiver_log 1.0.4 Download quiver_log 1.0.4 archive
1.0.3 Aug 8, 2014 Go to the documentation of quiver_log 1.0.3 Download quiver_log 1.0.3 archive
1.0.2 Aug 8, 2014 Go to the documentation of quiver_log 1.0.2 Download quiver_log 1.0.2 archive
1.0.1 Mar 30, 2014 Go to the documentation of quiver_log 1.0.1 Download quiver_log 1.0.1 archive
1.0.0 Mar 30, 2014 Go to the documentation of quiver_log 1.0.0 Download quiver_log 1.0.0 archive
Popularity:
Describes how popular the package is relative to other packages. [more]
41
Health:
Code health derived from static analysis. [more]
97
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
0
Overall:
Weighted score of the above. [more]
50
Learn more about scoring.

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

  • Dart: 2.0.0-dev.69.0
  • pana: 0.11.7

Platforms

Detected platforms: web

Platform components identified in package: html.

Issues and suggestions

Maintain CHANGELOG.md.

Changelog entries help clients to follow the progress in your code.

Use constrained dependencies.

The pubspec.yaml contains 2 dependencies without version constraints. Specify version ranges for the following dependencies: intl, logging.

Package is too old.

The package was released more than two years ago.

The description is too short.

Add more detail about the package, what it does and what is its target use case. Try to write at least 60 characters.

Format lib/log.dart.

Run dartfmt to format lib/log.dart.

Format lib/src/log.dart.

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

Format lib/src/web.dart.

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

Format lib/web.dart.

Run dartfmt to format lib/web.dart.

Maintain an example.

None of the files in your example/ directory matches a known example patterns. Common file name patterns include: main.dart, example.dart or you could also use quiver_log.dart.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=0.8.7
intl >=0.9.9 0.15.7
logging >=0.9.0 0.11.3+2
Transitive dependencies
path 1.6.2
Dev dependencies
mock >=0.10.0
test >=0.12.13