A cross-platform classic and minimalist logger written in the Dart language

yyyy-MM-dd 09:58:33.352 [info ] (main:12:10) - ╭━━━┳╮╱╱╱╱╱╱╱╱╱╱╱╱╱╱╭╮
yyyy-MM-dd 09:58:33.352 [info ] (main:12:10) - ┃╭━╮┃┃╱╱╱╱╱╱╱╱╱╱╱╱╱╱┃┃
yyyy-MM-dd 09:58:33.352 [info ] (main:12:10) - ┃┃╱╰┫┃╭━━┳━━┳━━┳┳━━╮┃┃╱╱╭━━┳━━┳━━┳━━┳━╮
yyyy-MM-dd 09:58:33.352 [info ] (main:12:10) - ┃┃╱╭┫┃┃╭╮┃━━┫━━╋┫╭━╯┃┃╱╭┫╭╮┃╭╮┃╭╮┃┃━┫╭╯
yyyy-MM-dd 09:58:33.352 [info ] (main:12:10) - ┃╰━╯┃╰┫╭╮┣━━┣━━┃┃╰━╮┃╰━╯┃╰╯┃╰╯┃╰╯┃┃━┫┃
yyyy-MM-dd 09:58:33.352 [info ] (main:12:10) - ╰━━━┻━┻╯╰┻━━┻━━┻┻━━╯╰━━━┻━━┻━╮┣━╮┣━━┻╯
yyyy-MM-dd 09:58:33.352 [info ] (main:12:10) - ╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╭━╯┣━╯┃
yyyy-MM-dd 09:58:33.352 [info ] (main:12:10) - ╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╰━━┻━━╯


  • This library provides minimalist and classic logging.
  • Also it provides very lightweight and clear logs.
  • If you just need cool logs like below, then this is the library you’re looking for!

    1.1. Features

    • Logging based on log level
    • Log coloring by ANSI escape code
    • Possible to output to console and file and event at the same time
    • Provides customizable log configuration

    And this library provides these well-known log levels.

    • trace
    • debug
    • info
    • warn
    • error
    • fatal

    1.2. Getting Started

    1.2.1. Install Library

    With Dart:

    dart pub add classic_logger

    Or with Flutter:

    flutter pub add classic_logger

    1.2.2. Import Package

    import 'package:classic_logger/classic_logger.dart';

    1.2.3. Log with Default Config

    import 'package:classic_logger/classic_logger.dart';
    
    void main() {
      // The easiest way to use default logger.
      final logger = Logger();
    
      logger.trace('Trace');
      logger.debug('Debug');
      logger.info('Info');
      logger.warn('Warn');
      logger.error('Error');
      logger.fatal('Fatal');
    
      logger.dispose();
    }

    1.2.4. Log with Custom Config

    import 'package:classic_logger/classic_logger.dart';
    
    void main() {
      // The way to use custom logger.
      final customLogger = Logger.fromConfig(LogConfig(
        baseLevel: LogLevel.info,
        output: MultiOutput([
          ConsoleOutput(),
          FileOutput('log.txt'),
        ]),
      ));
    
      customLogger.trace('Trace');
      customLogger.debug('Debug');
      customLogger.info('Info');
      customLogger.warn('Warn');
      customLogger.error('Error');
      customLogger.fatal('Fatal');
    
      customLogger.dispose();
    }

    1.3. Contribution

    If you would like to contribute to classic-logger.dart, please create an issue or create a Pull Request.

    Owner will respond to issues and review pull requests as quickly as possible.

    1.4. Support

    The simplest way to show us your support is by giving the project a star at here.

    And I’m always looking for sponsors to support this project. I do need support to continue ongoing open source development.

    Sponsors can be individuals or corporations, and the amount is optional.

    ? Click on the button below to see more details! ?

    1.5. License

    All resources of classic-logger.dart is provided under the BSD-3 license.

    Note: License notices in the source are strictly validated based on .github/header-checker-lint.yml. Please check header-checker-lint.yml for the permitted standards.

    1.6. More Information

    Classic Logger was designed and implemented by Kato Shinya.

    GitHub

    View Github