Documentation ¶
Index ¶
Constants ¶
View Source
const ( TagPid = "pid" TagTime = "time" TagReferer = "referer" TagProtocol = "protocol" TagID = "id" TagIP = "ip" TagIPs = "ips" TagHost = "host" TagMethod = "method" TagPath = "path" TagURL = "url" TagUA = "ua" TagLatency = "latency" TagStatus = "status" TagResBody = "resBody" TagQueryStringParams = "queryParams" TagBody = "body" TagBytesSent = "bytesSent" TagBytesReceived = "bytesReceived" TagRoute = "route" TagError = "error" TagHeader = "header:" TagLocals = "locals:" TagQuery = "query:" TagForm = "form:" TagCookie = "cookie:" )
Logger variables
Variables ¶
This section is empty.
Functions ¶
func Initialize ¶ added in v1.3.0
Initialize is a convenience function to configure Zerolog with some useful defaults.
Types ¶
type Config ¶
type Config struct { // Skipper defines a function to skip this middleware when returned true. // This field is used only by Echo. // // Optional. Default: nil Skipper middleware.Skipper // Format defines the logging tags // // Optional. Default: []string{TagTime, TagStatus, TagLatency, TagMethod, TagPath} Format []string // TimeZone can be specified, such as "UTC" and "America/New_York" and "Asia/Chongqing", etc // // Optional. Default: "Local" TimeZone string // TimeFormat https://programming.guide/go/format-parse-string-time-date-example.html // // Optional. Default: time.RFC3339 TimeFormat string // TimeInterval is the delay before the timestamp is updated // // Optional. Default: 500 * time.Millisecond, Minimum: 500 * time.Millisecond TimeInterval time.Duration // Output is an io.Writer where logs can be written. Zerologger will copy // the global Logger if Output is not set. Typically used in tests. // // Optional. Default: nil Output io.Writer // PrettyLatency prints the latency as a string instead of a number. // // Optional. Default: false PrettyLatency bool // contains filtered or unexported fields }
Config defines the Zerologger config for the middleware.
Click to show internal directories.
Click to hide internal directories.