simplest_logger

A lightweight, opinionated, colorful logging utility for Dart applications that provides an easy-to-use interface for console logging with minimal configuration.

  • Colored console output (info: green, warning: yellow, debug: blue, error: red)
  • Automatic timestamps for all log messages
  • Automatic class name labeling
  • Simple mixin for quick integration
  • Runtime-configurable logging levels
  • Zero dependencies

Usage

The most basic usage is to use the SimplestLogger class directly:

final logger = SimplestLogger('MyClass', LogLevel.all);
logger.info('Application started');    // Green output
logger.warning('Cache miss');          // Yellow output
logger.debug('Processing request');    // Blue output
logger.error('Connection failed');     // Red output

For a more integrated approach, you can use the SimplestLoggerMixin mixin:

class MyService with SimplestLoggerMixin {
  void doSomething() {
    logger.info('Operation started');
  }
}

You can control whether logging is enabled using LogLevel:

class ProductionService with SimplestLoggerMixin {
    ProductionService() {
        // Disable logging for production
        logLevel = LogLevel.off;
    }
}

License

This project is licensed under the MIT License - see the LICENSE file for details.

Libraries

simplest_logger