child method

BloomLogger child(
  1. String subContext
)

Creates a child logger with subContext appended to this logger's context.

Inherits the current level and writer from the parent logger.

Example

final dbLogger = logger.child('DATABASE');
dbLogger.info('Connected to PostgreSQL'); // logs with context [BLOOM:DATABASE]

Implementation

BloomLogger child(String subContext) {
  final newContext = context.isEmpty ? subContext : '$context:$subContext';
  return BloomLogger(
    context: newContext,
    level: level,
    writer: writer,
  );
}