LoggingInterceptor class

An interceptor that reports each request and the response it gets.

Records go out under SC:Http, at StreamLogPriority.debug, or StreamLogPriority.warning for a request that failed. Nothing is written, or even formatted, until an app installs a StreamLogHandler.

requestHeader puts the Authorization header in the record along with the rest, so consider what reads these before turning it on.

Inheritance

Constructors

LoggingInterceptor({bool request = true, bool requestHeader = false, bool requestBody = true, bool responseHeader = false, bool responseBody = true, bool error = true, int maxWidth = 120, bool compact = true, LogPrint? logPrint, String tag = 'SC:Http'})
Creates a new LoggingInterceptor.

Properties

compact bool
Whether to report a nested map on one line, rather than one key per line.
final
error bool
Whether to report a request that failed.
final
hashCode int
The hash code for this object.
no setterinherited
logPrint LogPrint?
Takes each line instead of the logger, for a caller routing them somewhere of its own.
final
maxWidth int
The width a line is wrapped at.
final
request bool
Whether to report the request line.
final
requestBody bool
Whether to report the request body.
final
requestHeader bool
Whether to report the request's headers, query parameters and extras.
final
responseBody bool
Whether to report the response body.
final
responseHeader bool
Whether to report the response headers.
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.
override
onRequest(RequestOptions options, RequestInterceptorHandler handler) → void
Called when the request is about to be sent.
override
onResponse(Response response, ResponseInterceptorHandler handler) → void
Called when the response is about to be resolved.
override
toString() String
A string representation of this object.
inherited

Operators

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

Constants

initialTab → const int
The indent a nested value starts at.
tabStep → const String
One level of indent.