LoggingInterceptor class
A Dio interceptor that logs HTTP requests and responses using AstuteLogger. This interceptor provides comprehensive logging of HTTP traffic including:
- Request method and URL
- Response status code
- Request/response headers (with Authorization header redacted)
- Request/response body
- Response time
Constructors
- LoggingInterceptor({required AstuteLogger logger, bool logRequestHeaders = true, bool logRequestBody = true, bool logResponseHeaders = true, bool logResponseBody = true, int maxBodyLength = 2000, int maxHeaderValueLength = 500})
- Creates a new LoggingInterceptor.
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- logger → AstuteLogger
-
final
- logRequestBody → bool
-
final
- logRequestHeaders → bool
-
final
- logResponseBody → bool
-
final
- logResponseHeaders → bool
-
final
- maxBodyLength → int
-
final
- maxHeaderValueLength → int
-
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(
DioException err, ErrorInterceptorHandler handler) → void - Called when an exception was occurred during the request.
-
onRequest(
RequestOptions options, RequestInterceptorHandler handler) → void - Called when the request is about to be sent.
-
onResponse(
Response response, ResponseInterceptorHandler handler) → void - Called when the response is about to be resolved.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited