slog_basic 0.1.1 copy "slog_basic: ^0.1.1" to clipboard
slog_basic: ^0.1.1 copied to clipboard

A set of pre-made printers and interceptors that can be used with SLog also a good example of printers and interceptors.

example/main.dart

import 'dart:async';

import 'package:slog_basic/slog_basic.dart';
import 'package:slog_basic/src/printers.dart';
import 'package:slog_core/logger.dart';

void main(List<String> args) {
  Logger.init(
    options: SLogOptions(
      interceptors: [
        PrintInterceptor(),
      ],
      printers: [
        JsonPrinter(),
      ],
    ),
  )
    ..registerChannel('event')
    ..registerChannel('api');

  var counter = 3;
  Timer.periodic(const Duration(seconds: 2), (timer) {
    Logger.I.log('Tick', level: Level.INFO, data: timer.tick, channel: 'event');
    counter--;
    if (counter == 0) {
      Logger.I.log('Timer cancel', level: Level.WARNING, channel: 'api');
      timer.cancel();
    }
  });
}
0
likes
150
points
24
downloads

Publisher

unverified uploader

Weekly Downloads

A set of pre-made printers and interceptors that can be used with SLog also a good example of printers and interceptors.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

slog_core, stack_trace

More

Packages that depend on slog_basic