Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // DefaultLoggerConfig is the default Logger middleware config. DefaultLoggerConfig = LoggerConfig{ Skipper: skipper.DefaultSkipper, Format: `{"time":"${time_rfc3339}","remote_ip":"${remote_ip}",` + `"method":"${method}","uri":"${uri}","status":${status}, "latency":${latency},` + `"latency_human":"${latency_human}","bytes_in":${bytes_in},` + `"bytes_out":${bytes_out}}` + "\n", Output: os.Stdout, // contains filtered or unexported fields } )
Functions ¶
func LoggerWithConfig ¶
func LoggerWithConfig(config LoggerConfig) macross.Handler
LoggerWithConfig returns a Logger middleware with config. See: `Logger()`.
Types ¶
type LoggerConfig ¶
type LoggerConfig struct { // Skipper defines a function to skip middleware. Skipper skipper.Skipper // Log format which can be constructed using the following tags: // // - time_rfc3339 // - id (Request ID - Not implemented) // - remote_ip // - uri // - host // - method // - path // - referer // - user_agent // - status // - latency (In microseconds) // - latency_human (Human readable) // - bytes_in (Bytes received) // - bytes_out (Bytes sent) // // Example "${remote_ip} ${status}" // // Optional. Default value DefaultLoggerConfig.Format. Format string `json:"format"` // Output is a writer where logs are written. // Optional. Default value os.Stdout. Output io.Writer // contains filtered or unexported fields }
LoggerConfig defines the config for Logger middleware.
Click to show internal directories.
Click to hide internal directories.