logging library

Sub-library entrypoint re-exporting the underlying logging package.

Design Rationale

BasicLogger is built on top of Dart's standard package:logging. Downstream applications often need to interact directly with standard logging primitives—such as setting log thresholds via Level, configuring Logger.root, or formatting LogRecord instances.

By providing this dedicated sub-library entrypoint, applications using basic_logger can access the complete package:logging API on demand without needing to declare an additional, redundant dependency on logging in their own pubspec.yaml.

Typical Use Cases

  • Configuring global or hierarchical log levels (Level.ALL, Level.INFO, etc.).
  • Intercepting and listening to log streams (Logger.root.onRecord.listen(...)).
  • Customizing log message formatting via LogRecord properties.
  • Utilizing standard Logger instances in third-party or infrastructure modules.

Usage Example

import 'package:basic_logger/basic_logger.dart';
import 'package:basic_logger/logging.dart';

void main() {
  // Configure root log level using re-exported Level and Logger classes
  Logger.root.level = Level.ALL;

  final logger = BasicLogger('app');
  logger.info('Application started');
}

Classes

Level
Levels to control logging output. Logging can be enabled to include all levels above certain Level. Levels are ordered using an integer value Level.value. The predefined Level constants below are sorted as follows (in descending order): Level.SHOUT, Level.SEVERE, Level.WARNING, Level.INFO, Level.CONFIG, Level.FINE, Level.FINER, Level.FINEST, and Level.ALL.
Logger
Use a Logger to log debug messages.
LogRecord
A log entry representation used to propagate information from Logger to individual handlers.

Constants

defaultLevel → const Level
The default Level.

Properties

hierarchicalLoggingEnabled ↔ bool
Whether to allow fine-grain logging and configuration of loggers in a hierarchy.
getter/setter pair
recordStackTraceAtLevel ↔ Level
Automatically record stack traces for any message of this level or above.
getter/setter pair