basic_logger 0.2.0 copy "basic_logger: ^0.2.0" to clipboard
basic_logger: ^0.2.0 copied to clipboard

BasicLogger is a fast, extensible, simple and lightweight logging tool for Dart and Flutter.

BasicLogger is a fast, extensible, simple and lightweight logging tool for Dart and Flutter..

Features #

It is distributed as a single file module and has no dependencies other than the Dart Standard Library.

Getting started #

  dart pub add basic_logger
  flutter pub add basic_logger

Usage #

  Logger.root.level = Level.ALL;
  final basicLogger = BasicLogger('main');

  // attach developer log
  basicLogger.attachLogger(DevOutputLogger(basicLogger.name));

  // attach output log, 
  // selfname, default console
  // selfonly, if true filter by selfname, else parentName match are output.
  final consoleLogger = basicLogger.attachLogger(OutputLogger(
    basicLogger.name,
    // selfname: 'console',
    // selfonly: true,
  ));

  // output to all attach instance
  basicLogger.info('hello world');
  
  // output buffer to all attach instance, not include detach instance
  basicLogger.output();

  // output
  // 2024-10-15 02:52:11.405809 [INFO] main: hello world

Flutter Usage #

  Logger.root.level = Level.ALL;
  final basicLogger = BasicLogger('main');

  // attach observer, console log use debugPrint
  basicLogger.attachLogger(
    OutputLogger(basicLogger.name)..record = debugPrint,
    );

  basicLogger.info('hello world');
)    

Additional information #

  • FileOutputLogger, file-based logging for Android, iOS, Linux, macOS, and Windows platforms.
dart pub add basic_logger_file
flutter pub add basic_logger_file
  • FileOutputLogger, specify output file path
  basicLogger.attachLogger(FileOutputLogger(
    basicLogger.name,
    dir: './logs/',
  ));
  • FileOutputLogger, specify output buffer size
  // buffering allows you to write files multiple times instead of writing files once
  basicLogger.attachLogger(FileOutputLogger(
    basicLogger.name,
    bufferSize: 100,
  ));

  // output and clear buffer
  basicLogger.output();
0
likes
160
points
42
downloads

Publisher

verified publisheriche2.com

Weekly Downloads

BasicLogger is a fast, extensible, simple and lightweight logging tool for Dart and Flutter.

Homepage
Repository (GitHub)

Topics

#logging #console #debug #user-logs

Documentation

API reference

License

MIT (license)

Dependencies

logging, path

More

Packages that depend on basic_logger