l 2.0.0-dev l: ^2.0.0-dev copied to clipboard
Cross-platform html/io Logger library with simple API. Manipulate with native console and store logs in txt files and indexedDB. Support ascii colorize output.
// ignore_for_file: unnecessary_statements, avoid_print, cascade_invocations
import 'dart:async' show Future;
import 'package:l/l.dart';
void main() => _displayStatuses()
.whenComplete(_showProgressBar)
.whenComplete(_displayDetails);
Future<void> _displayStatuses() async {
l.store = true;
l.s('shout me');
l.e('error msg');
l.w('warning msg');
l.i('info msg');
l < 'alt info msg';
l.d('debug msg');
l << 'alt debug msg';
}
Future<void> _showProgressBar() =>
Stream<int>.fromIterable(List<int>.generate(101, (v) => v))
.asyncMap<int>((v) =>
Future<int>.delayed(const Duration(milliseconds: 50), () => v))
.forEach((v) => l.p(
percent: v,
header: '{{ HEADER #$v }}',
footer: '{{ footer #$v }}',
data: '{{ data $v% }}'))
..whenComplete(l.resume);
Future<void> _displayDetails() async {
l.v('verbose lvl #1');
l.vv('verbose lvl #2');
l.vvv('verbose lvl #3');
l.vvvv('verbose lvl #4');
l.vvvvv('verbose lvl #5');
l.vvvvvv('verbose lvl #6');
}