Documentation
¶
Index ¶
Constants ¶
const ( ClientErrorMessage = "A client error occurred." ServerErrorMessage = "A server error occurred." ResponseServedMessage = "An HTTP response was served." )
The messages the mux logs an error response under. What is worth saying about one is in the HTTP context rather than here -- what was requested, and what came back -- so a log handler that reads that context may replace them with what it says. They are re-exported by the mux package, for a handler to match against by name rather than by a string written out a second time.
Variables ¶
This section is empty.
Functions ¶
func DefaultDoneCallback ¶
DefaultDoneCallback logs the response a mux has finished serving. It is logged at debug level, there being nothing wrong with a response that was served: what it is worth reading is the record of what was asked for and what came back, which a log handler reading the HTTP context adds.
Whether anything comes of it is left to the level the logger is set to, rather than to a check of its own: a service whose logger is set to debug says so by being set to debug.
The level is asked before the record is built rather than left to the logging call, which would build the attributes it is given and only then drop them. A service not logging at debug pays a level check per response and nothing else.
func DefaultResponseErrorHandler ¶
func DefaultResponseErrorHandler( ctx context.Context, responseError *muxTypesResponseError.ResponseError, responseWriter *muxTypesResponse.ResponseWriter, )
Types ¶
This section is empty.