Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var DefaultConfig = &Config{ Template: "{{.Request.Method}} {{.Request.URL.Path}} {{.Duration.String}}", Logger: log.Default(), CallDepth: 2, }
DefaultConfig contains the default value for the logging middleware configuration
Functions ¶
func New ¶
func New(configure ...func(*Config)) lungo.Middleware
New creates a new logging middleware instance
Types ¶
type ColorCode ¶
type ColorCode int
ColorCode defines identifiers to be used as ANSI color escape sequences
const ( // Error is the ANSI color code for red Error ColorCode = 31 // Success is the ANSI color code for green Success ColorCode = 32 // Warning is the ANSI color code for orange Warning ColorCode = 33 // Info is the ANSI color code for blue Info ColorCode = 34 // Debug is the ANSI color code for magenta Debug ColorCode = 35 // Notice is the ANSI color code for cyan Notice ColorCode = 36 // Reset is the ANSI color code to reset the color Reset ColorCode = 0 )
type Config ¶
type Config struct { // Template defines the logging format as a text/template string. // // see: https://golang.org/pkg/text/template/ // // Available Tags: // - "Request": *http.Request // - "Duration": *time.Duration // // Optional. Default: Template string // Logger defines the log.Logger instance to use for logging. // By default the standard logger is used, which makes it // equivalent to calling log.Printf(). // // Optional. Default: log.Default() Logger *log.Logger // CallDepth defines the call stack depth to use for logging. // // Optional. Default: 2 CallDepth int }
Config defines the configuration options for the logging middleware
Click to show internal directories.
Click to hide internal directories.