LoggingInterceptor class

Logs each request and its outcome through ApiConfig().logger.

Nothing is emitted unless a logger is configured, so adding this to a request chain is inert in production by default:

ApiConfig().logger = debugPrint;
// ...
interceptors: [LoggingInterceptor()]
Inheritance

Constructors

LoggingInterceptor({bool logHeaders = true, bool logBody = true, int maxBodyLength = 1000, Set<String>? redactHeaders})

Properties

hashCode → int
The hash code for this object.
no setterinherited
logBody → bool
Whether to log request and response bodies.
final
logHeaders → bool
Whether to log request and response headers.
final
maxBodyLength → int
Maximum number of body characters to log before truncating.
final
redactHeaders → Set<String>
Header names replaced with *** in the output, matched case-insensitively.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
onError<R, I>(ApiResponse<R, I> response) → ApiResponse<R, I>
Intercepts the error and returns the modified response
override
onRequest<R, I>(ApiRequest<R, I> request) → ApiRequest<R, I>
Intercepts the request and returns the modified request
override
onResponse<R, I>(ApiResponse<R, I> response) → ApiResponse<R, I>
Intercepts the response and returns the modified response
override
toString() → String
A string representation of this object.
inherited

Operators

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