LoggingHttpMessageHandler class

Handles logging of the lifecycle for an HTTP request.

This handler logs:

  • Request start (method, URI, headers)
  • Request completion (status code, elapsed time, headers)
  • Request failures (exception details, elapsed time)

Header values can be redacted using the shouldRedactHeaderValue function.

Inheritance

Constructors

LoggingHttpMessageHandler({required Logger logger, bool shouldRedactHeaderValue(String)?, HttpMessageHandler? innerHandler})
Creates a new LoggingHttpMessageHandler with the specified logger.

Properties

hashCode int
The hash code for this object.
no setterinherited
innerHandler HttpMessageHandler?
getter/setter pairinherited
logger Logger
The logger used for logging HTTP request information.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
shouldRedactHeaderValue bool Function(String)?
A function that determines whether to redact a header value.
final

Methods

dispose() → void
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
send(BaseRequest request) Future<StreamedResponse>
override
toString() String
A string representation of this object.
inherited

Operators

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

Constants

redactedPlaceholder → const String
Redaction placeholder used when a header value should be hidden.