quick_log 0.2.0

  • Readme
  • Changelog
  • Example
  • Installing
  • 84

An easy to use and extendable logging package for Dart. Especially useful for use in libraries, as it allows application to control logging from the imported libraries.

Console Printer Output

Usage #

A simple usage example:

import 'package:quick_log/quick_log.dart';

void main() {
  const log = Logger('LogExample');

  log.debug('this is a debug message');
  log.info('this is an info message');
}

Configuring logger output:

import 'package:quick_log/quick_log.dart';

void main() {
  const log = Logger('LogExample');

  Logger.writer = ConsolePrinter(minLevel: LogLevel.info);

  log.debug('this is a debug message');
  log.info('this is an info message');
}

Ignoring logs:

import 'package:quick_log/quick_log.dart';

class ExampleLogger extends Logger {
  const ExampleLogger(String name) : super(name, 'ExampleLogger');
}

void main() {
  const log = ExampleLogger('LogExample');

  Logger.writer = ConsolePrinter(onlyNamespace: []);
  // Or
  Logger.writer = ConsolePrinter(exceptNamespace: [log.namespace]);

  // These messages won't be printed
  log.debug('this is a debug message');
  log.info('this is an info message');
}

Features #

  • Similar to Dart logging package and logging libraries in other languages
  • Completely configurable and extendable Logger and LogWriter

Please file feature requests and bugs at the issue tracker.

0.2.0 #

  • update dart_console library

0.1.3 #

  • Minor changes

0.1.2 #

  • Added option to enable or disable console printer during release mode (disabled by default)

0.1.1 #

  • Implement suggestions

0.1.0 #

  • Initial version

example/main.dart

import 'package:quick_log/quick_log.dart';

class ExampleLogger extends Logger {
  const ExampleLogger(String name) : super(name, 'ExampleLogger');
}

void main() {
  const log = ExampleLogger('LogExample');

  Logger.writer = ConsolePrinter(minLevel: LogLevel.info, enableInReleaseMode: true);

  log.debug('this is a debug message');
  log.info('this is an info message');
}

Use this package as a library

1. Depend on it

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


dependencies:
  quick_log: ^0.2.0

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:quick_log/quick_log.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
68
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
84
Learn more about scoring.

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

  • Dart: 2.6.1
  • pana: 0.13.1+4

Health issues and suggestions

Document public APIs. (-0.39 points)

47 out of 48 API elements have no dartdoc comment.Providing good documentation for libraries, classes, functions, and other API elements improves code readability and helps developers find and use your API.

Format lib/src/log_message.dart.

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

Format lib/src/log_writer.dart.

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

Format lib/src/logger.dart.

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

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.6.0 <3.0.0
dart_console ^0.4.0 0.4.0 0.5.0-dev.2
path ^1.6.0 1.6.4
rxdart ^0.22.2 0.22.6 0.23.0-dev.3
Transitive dependencies
ffi 0.1.3
Dev dependencies
pedantic ^1.7.0
test ^1.6.0