reqlog

package
v0.2.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 15, 2019 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const ExternalConfigName = "reqlog"

ExternalConfigName is the external config name of request logger.

Variables

This section is empty.

Functions

func Default

func Default() nirvana.Configurer

Default Configurer does nothing but ensure default config was set.

func Disable

func Disable() nirvana.Configurer

Disable returns a configurer to disable reqlog.

func DoubleLog

func DoubleLog(enable bool) nirvana.Configurer

DoubleLog returns a configurer to enable or disable double log. If it's enabled, every request outputs two entries. One for starting and another for ending. If it's disabled, only outputs ending entry. Defaults to false.

func Logger

func Logger(l log.Logger) nirvana.Configurer

Logger Configurer sets logger.

func RequestID

func RequestID(enable bool) nirvana.Configurer

RequestID returns a configurer to enable or disable showing request id. Defaults to false.

func RequestIDKey

func RequestIDKey(key string) nirvana.Configurer

RequestIDKey returns a configurer to set header key of request id. Defaults to X-Request-Id.

func SourceAddr

func SourceAddr(enable bool) nirvana.Configurer

SourceAddr returns a configurer to enable or disable showing source addr. Defaults to false.

Types

type Option

type Option struct {
	DoubleLog    bool   `desc:"Output two entries for every request"`
	SourceAddr   bool   `desc:"Output source addr for request log"`
	RequestID    bool   `desc:"Output request id for request log"`
	RequestIDKey string `desc:"Request header key for request id"`
}

Option contains basic configurations of reqlog.

func NewDefaultOption added in v0.2.0

func NewDefaultOption() *Option

NewDefaultOption creates default option.

func (*Option) Configure

func (p *Option) Configure(cfg *nirvana.Config) error

Configure configures nirvana config via current options.

func (*Option) Name

func (p *Option) Name() string

Name returns plugin name.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL