loggable 1.0.1

  • Readme
  • Changelog
  • Example
  • Installing
  • new64

Loggable #

Package provide simple Loggable mixin to avoid typing class name for each class.

pub package

Usage #

Without Loggable:

import 'package:logging/logging.dart';

class MyClass{
  final Logger log = Logger("MyClass");
}

With Loggable:

import 'package:loggable/loggable.dart';

class MyClass extends Object with Loggable {
}

Features and bugs #

  • There is no support for logging from the static methods. Still need to creating Logger instance by hands.

Please file feature requests and bugs at the issue tracker.

1.0.1 #

  • Do not store Logger reference in mutable private var to avoid immutable linter warning

1.0.0 #

  • Initial version

example/loggable_example.dart

import 'package:loggable/loggable.dart';
import 'package:logging/logging.dart';

class MyClass extends Object with Loggable {
  void myMethod(){
    log.info("myMethod()");
  }
}

main() {

  Logger.root.level = Level.ALL;
  Logger.root.onRecord.listen((LogRecord rec) {
    print('[${rec.level.name.padRight(7)}] [${rec.loggerName.padRight(25)}] ${rec.message}');
  });

  var myClass = MyClass();


  myClass.myMethod();
}

Use this package as a library

1. Depend on it

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


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

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

Health issues and suggestions

Document public APIs. (-1 points)

4 out of 4 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.

Maintenance suggestions

The package description is too short. (-20 points)

Add more detail to the description field of pubspec.yaml. Use 60 to 180 characters to describe the package, what it does, and its target use case.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.5.0 <3.0.0
logging ^0.11.3+2 0.11.3+2
Dev dependencies
pedantic ^1.8.0
test ^1.6.0