l 4.0.1 copy "l: ^4.0.1" to clipboard
l: ^4.0.1 copied to clipboard

Cross-platform html/io Logger library with simple API. Manipulate with native and web console. Support ascii colorize output.

example/main.dart

// ignore_for_file: public_member_api_docs, avoid_print
library l.example;

import 'dart:async';

import 'package:l/l.dart';

void main() => runZonedGuarded<void>(
      () => l.capture<void>(
        () {
          l
            ..v('Regular 1')
            ..e('Error')
            ..w('Warning')
            ..i('Info')
            ..d('Debug')
            ..s('Shout')
            ..v6('Regular 6');
          print('Hello from original print!');
          l.v('Running');
          throw Exception('Exception');
        },
        const LogOptions(
          handlePrint: true,
          messageFormatting: _messageFormatting,
          outputInRelease: false,
          printColors: true,
        ),
      ),
      l.e,
    );

Object _messageFormatting(Object message, LogLevel logLevel, DateTime now) =>
    '${_timeFormat(now)} | $message';

String _timeFormat(DateTime time) =>
    '${time.hour}:${time.minute.toString().padLeft(2, '0')}';
86
likes
140
pub points
91%
popularity

Publisher

verified publisherplugfox.dev

Cross-platform html/io Logger library with simple API. Manipulate with native and web console. Support ascii colorize output.

Homepage
Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

meta

More

Packages that depend on l