tracer 0.2.0 copy "tracer: ^0.2.0" to clipboard
tracer: ^0.2.0 copied to clipboard

A modern, simple and easy-to-implement logging framework for Dart.

example/tracer_example.dart

import 'dart:async';
import 'dart:io';

import 'package:tracer/tracer.dart';

void main() {
  var t = Tracer("example", logLevel: TracerLevel.debug, handlers: [
    TracerConsoleHandler(),
    TracerFileHandler(Directory(
        "${Directory.fromUri(Platform.script).parent.parent.path}${Platform.pathSeparator}logs"))
  ]);
  t.debug("This is a debug message");
  t.info("This is an info message");
  t.warn("This is a warning message");
  t.error("This is an error message");
  t.fatal("This is a fatal message");

  print("-----");

  t.info("This will have a description", description: "I AM THE DESCRIPTION!");
  t.warn("Multiline description", description: "Line 1\nLine 2\nLine 3");

  print("-----");

  try {
    throw Exception("This is an exception");
  } catch (e) {
    t.error("This is an error with an exception", error: e);
  }
  try {
    throw Exception("This is a second exception");
  } catch (e, s) {
    t.fatal("This is an error with an exception and stack trace",
        error: e, stack: s);
  }

  runZonedGuarded(() {
    throw Exception("This is an exception in a zone");
  }, (error, stack) {
    t.fatal(
        "This is an error with an exception and stack trace, triggered by a zone",
        error: error,
        stack: stack);
  });
}
1
likes
150
points
56
downloads

Publisher

verified publisherjhubi1.com

Weekly Downloads

A modern, simple and easy-to-implement logging framework for Dart.

Repository (GitHub)
View/report issues

Topics

#logging #tracer #error

Documentation

API reference

License

Apache-2.0 (license)

Dependencies

event, intl, stack_trace, web

More

Packages that depend on tracer