dart_log 1.2.0 copy "dart_log: ^1.2.0" to clipboard
dart_log: ^1.2.0 copied to clipboard

A simple dart console logger (release mode enabled/disabled and "limitless" characters)

example/dart_log_example.dart

import 'dart:developer';

import 'package:dart_log/dart_log.dart';

void main() async {
  Logger.prefix = '';
  Logger.interceptors.add(DefaultLogInterceptor((Object? data) {
    log('** Interceptor ($data) **');
  }));

  Logger.interceptors.add(DefaultLogInterceptor((Object? data) {
    print('\x1B[31mONLY ERROR: $data\x1B[0m');
  }, logTypes: [LogType.error]));

  Logger.interceptors.add(DefaultLogInterceptor((Object? data) {
    print('\x1B[33mWARNING OR INFO: $data\x1B[0m');
  }, logTypes: [LogType.warn, LogType.info]));

  logger.d('"debug message"');
  logger.e('"error message"');
  logger.i('"info message"');
  logger.w('"warn message"');
  logger.trace('"trace message"', stackTrace: StackTrace.current);
  logger.prod('"prod message"');

  await Future.delayed(Duration.zero);
}
2
likes
160
points
444
downloads

Publisher

unverified uploader

Weekly Downloads

A simple dart console logger (release mode enabled/disabled and "limitless" characters)

Repository (GitHub)
View/report issues

Documentation

API reference

License

BSD-3-Clause (license)

More

Packages that depend on dart_log