quick_log 0.1.1

  • Readme
  • Changelog
  • Example
  • Installing
  • new70

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.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);

  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.1.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:quick_log/quick_log.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
40
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]
70
Learn more about scoring.

We analyzed this package on Oct 16, 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:quick_log/quick_log.dart.

Health issues and suggestions

Document public APIs. (-0.38 points)

46 out of 47 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.2.2 <3.0.0
path ^1.6.0 1.6.4
rxdart ^0.22.2 0.22.3
Dev dependencies
pedantic ^1.7.0
test ^1.6.0