LoggingConfig class

Configuration for VooLogger output and behavior.

Quick Setup

// Use presets for common scenarios
await VooLogger.initialize(config: LoggingConfig.development());
await VooLogger.initialize(config: LoggingConfig.production());

Custom Configuration

await VooLogger.initialize(
  config: LoggingConfig(
    // Output formatting
    enablePrettyLogs: true,    // Pretty boxes vs single-line
    showEmojis: true,          // Level icons (ℹ️ ⚠️ ❌)
    showTimestamp: true,       // HH:MM:SS.mmm
    showBorders: true,         // Box borders around logs
    showMetadata: true,        // Metadata section

    // Filtering
    minimumLevel: LogLevel.debug,  // Ignore verbose logs

    // Storage management
    maxLogs: 10000,            // Keep last 10k logs
    retentionDays: 7,          // Delete logs older than 7 days
    autoCleanup: true,         // Clean on startup
  ),
);

Presets

Constructors

LoggingConfig({bool enablePrettyLogs = true, bool showEmojis = true, bool showTimestamp = true, bool showColors = true, bool showBorders = true, bool showMetadata = true, int lineLength = 120, LogLevel minimumLevel = LogLevel.verbose, bool enabled = true, bool enableDevToolsJson = false, Map<LogType, LogTypeConfig> logTypeConfigs = const {}, int? maxLogs, int? retentionDays, bool autoCleanup = true, CloudSyncConfig? cloudSync, OtelLoggingConfig? otelConfig})
const
LoggingConfig.development()
factory
LoggingConfig.minimal()
Zero-config preset that works out of the box. Automatically detects debug/release mode and configures accordingly.
factory
LoggingConfig.production()
factory

Properties

autoCleanup → bool
Whether to automatically clean up old logs on initialization.
final
cloudSync → CloudSyncConfig?
Cloud sync configuration for sending logs to a backend API.
final
enabled → bool
final
enableDevToolsJson → bool
final
enablePrettyLogs → bool
final
formatter → PrettyLogFormatter
no setter
hashCode → int
The hash code for this object.
no setteroverride
lineLength → int
final
logTypeConfigs → Map<LogType, LogTypeConfig>
final
maxLogs → int?
Maximum number of logs to retain. Set to null for unlimited.
final
minimumLevel → LogLevel
final
otelConfig → OtelLoggingConfig?
OpenTelemetry configuration for OTLP log export.
final
retentionDays → int?
Maximum age of logs in days. Logs older than this will be cleaned up. Set to null to keep logs forever.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
showBorders → bool
final
showColors → bool
final
showEmojis → bool
final
showMetadata → bool
final
showTimestamp → bool
final

Methods

copyWith({bool? enablePrettyLogs, bool? showEmojis, bool? showTimestamp, bool? showColors, bool? showBorders, bool? showMetadata, int? lineLength, LogLevel? minimumLevel, bool? enabled, bool? enableDevToolsJson, Map<LogType, LogTypeConfig>? logTypeConfigs, int? maxLogs, int? retentionDays, bool? autoCleanup, CloudSyncConfig? cloudSync, OtelLoggingConfig? otelConfig}) → LoggingConfig
getConfigForCategory(String? category) → LogTypeConfig
getConfigForType(LogType type) → LogTypeConfig
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
inherited
withLogTypeConfig(LogType type, LogTypeConfig config) → LoggingConfig

Operators

operator ==(Object other) → bool
The equality operator.
override

Static Methods

mapCategoryToLogType(String? category) → LogType