StackLogDriver class

A log driver that combines multiple drivers into a single logging pipeline.

The stack driver allows you to send logs to multiple destinations simultaneously while providing error handling and middleware support for each destination.

Features:

  • Send logs to multiple destinations
  • Per-driver middleware support
  • Configurable error handling
  • Detailed error reporting

Example:

final stack = StackLogDriver([
  ConsoleLogDriver(),
  FileLogDriver('app.log'),
  WebhookLogDriver(Uri.parse('https://logs.example.com')),
]);

// Configure error handling
final stack = StackLogDriver(
  drivers,
  ignoreExceptions: true, // Continue if one driver fails
);
Inheritance

Constructors

StackLogDriver.new(List<LogDriver> _drivers, {bool ignoreExceptions = false})
Creates a stack driver that sends logs to multiple destinations.

Properties

hashCode int
The hash code for this object.
no setterinherited
ignoreExceptions bool
Whether to continue logging if a driver fails
final
name String
finalinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

log(LogEntry entry) Future<void>
Logs the provided entry using the driver's implementation
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
setMiddlewares(Map<String, List<DriverMiddleware>> driverMiddlewares, Map<String, List<DriverMiddleware>> channelMiddlewares) → void
Configures middleware for the stack driver.
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited