Documentation
¶
Index ¶
Constants ¶
View Source
const ( Duration = "duration" // In nanoseconds HTTPStatusCode = "http.status_code" HTTPMethod = "http.method" HTTPURLDetailsPath = "http.url_details.path" NetworkBytesWritten = "network.bytes_written" Operation = "op" Request = "request" RequestID = "http.request_id" RequestHeaders = "http.headers" RequestSize = "network.bytes_read" Response = "response" TraceID = "trace_id" UserID = "usr.id" Stack = "error.stack" )
Reference: https://docs.datadoghq.com/logs/log_configuration/attributes_naming_convention/#http-requests
Variables ¶
View Source
var MaxRequestBodyLog = 24 * 1024
MaxRequestBodyLog controls the maximum request body that can be logged. Anything greater will be truncated.
Functions ¶
func RequestLogger ¶
RequestLogger returns a handler that call initializes Op in the context, and logs each request.
Types ¶
type FnShouldLog ¶
FnShouldLog given a request, return flags that control logging. logRequest will disable the entire request logging middleware, default is true. logRequestBody will log the body of the request, default is false. logResponseBody will log the body of the response, default is false. This should be disabled for large or streaming results.
Click to show internal directories.
Click to hide internal directories.