Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var DefaultCharmLogConfig = CharmLogConfig{ FieldMap: defaultFields, Logger: charm.Default(), Skipper: mw.DefaultSkipper, }
DefaultCharmLogConfig is the default CharmBracelet Log middleware config.
Functions ¶
func CharmLog ¶
func CharmLog() echo.MiddlewareFunc
CharmLog returns a middleware that logs HTTP requests.
func CharmLogRecoverFn ¶
func CharmLogRecoverFn(logger *charm.Logger) mw.LogErrorFunc
CharmLogRecoverFn returns a CharmLog recover log function to print panic errors.
func CharmLogWithConfig ¶
func CharmLogWithConfig(cfg CharmLogConfig) echo.MiddlewareFunc
CharmLogWithConfig returns a CharmBracelet Log middleware with config. See: `CharmLog()`.
Types ¶
type CharmLogConfig ¶
type CharmLogConfig struct {
// FieldMap set a list of fields with tags
//
// Tags to constructed the logger fields.
//
// - @id (Request ID)
// - @remote_ip
// - @uri
// - @host
// - @method
// - @path
// - @route
// - @protocol
// - @referer
// - @user_agent
// - @status
// - @error
// - @latency (In nanoseconds)
// - @latency_human (Human readable)
// - @bytes_in (Bytes received)
// - @bytes_out (Bytes sent)
// - @header:<NAME>
// - @query:<NAME>
// - @form:<NAME>
// - @cookie:<NAME>
FieldMap map[string]string
// Logger it is a charm logger
Logger *charm.Logger
// Skipper defines a function to skip middleware.
Skipper mw.Skipper
}
CharmLogConfig defines the config for CharmBracelet Log middleware.
Click to show internal directories.
Click to hide internal directories.