one_logger 1.0.13 copy "one_logger: ^1.0.13" to clipboard
one_logger: ^1.0.13 copied to clipboard

Easy to use logger for single line logging. [date level service:module msg]

example/one_logger_example.dart

import 'package:one_logger/one_logger.dart';

void main() async {
  const logger = Logger(
    service: 'one_logger',
    defaultModule: 'example',
    filter: MyLogFilter() // Filtering debug
  );

  logger.info('this is info');
  logger.warn('this is warn');
  logger.error('this is error');
  logger.debug('this is debug');

  try {
    final list = [];
    list[2];
  } catch (e, st) {
    logger.error(e, stackTrace: st);
  }
}


class MyLogFilter extends LoggerFilter {
  const MyLogFilter();
  
  @override
  bool shouldPrintLog(Level level) {
    // return level.index < Level.debug.index;
    return true;
  }

  @override
  bool shouldPushLog(Level level) {
    return true;
  }  
}
2
likes
130
pub points
25%
popularity

Publisher

unverified uploader

Easy to use logger for single line logging. [date level service:module msg]

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

dio, equatable, intl, tuple

More

Packages that depend on one_logger