simplest_logger library
A lightweight, opinionated, colorful logging utility for Dart applications.
This library provides a simple yet powerful logging solution with minimal configuration required. It features:
- Colorful console output with ANSI colors (can be disabled)
- Simple API with info, warning, and error levels
- Context-based logging with automatic class name detection
- Convenient mixin for class-based logging
- Stack trace support for error logging
- No dependencies
Example usage:
final logger = SimplestLogger('MyApp');
// Log different message types
logger.info('Application started');
logger.warning('Resource usage is high');
logger.error('Database error',
Exception('Connection failed'),
StackTrace.current
);
// Configure logging globally
SimplestLogger.setLevel(SimplestLoggerLevel.warning);
SimplestLogger.useColors(false);
Classes
- SimplestLogger
- A logger instance that provides methods for logging messages with different severity levels.
Enums
- SimplestLoggerLevel
- Defines the available logging levels for controlling log output.
Mixins
- SimplestLoggerMixin
- A mixin that provides convenient access to a SimplestLogger instance.