LogInterceptor class abstract

A function-like object that intercepts and optionally transforms log events.

LogInterceptor allows you to observe, modify, or suppress log events as they pass through the logging pipeline. You provide a callback that receives each LogEvent and its LogInterceptorContext, and returns either a new (possibly modified) LogEvent, or null to suppress the event.

Example usage:

final LogInterceptorCallback callback = (event, context) {
  // Filter out debug-level logs
  if (event.level == Level.debug) return null;
  return event;
};
final interceptor = LogInterceptor(callback);

See also:

Implementers

Constructors

LogInterceptor(LogInterceptorCallback callback)
Creates a callback-backed LogInterceptor.
const
factory

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

call(LogEvent event, {required LogInterceptorContext context}) LogEvent?
Invokes the interceptor on the given event and context.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

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