zap

package
v3.0.0-beta.2 Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2019 License: OSL-3.0 Imports: 9 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Logger

type Logger struct {
	*zap.Logger
	// contains filtered or unexported fields
}

Logger is a Wrapper for the zap logger fulfilling the flamingo.Logger interface

func (*Logger) Debug

func (l *Logger) Debug(args ...interface{})

Debug logs a message at debug level

func (*Logger) Debugf

func (l *Logger) Debugf(log string, args ...interface{})

Debugf logs a message at debug level with format string

func (*Logger) Error

func (l *Logger) Error(args ...interface{})

Error logs a message at error level

func (*Logger) Fatal

func (l *Logger) Fatal(args ...interface{})

Fatal logs a message at fatal level The logger then calls os.Exit(1), even if logging at FatalLevel is disabled.

func (*Logger) Flush

func (l *Logger) Flush()

Flush is used by buffered loggers and triggers the actual writing. It is a good habit to call Flush before letting the process exit. For the top level flamingo.Logger, this is called by the app itself.

func (*Logger) Info

func (l *Logger) Info(args ...interface{})

Info logs a message at info level

func (*Logger) Panic

func (l *Logger) Panic(args ...interface{})

Panic logs a message at panic level The logger then panics, even if logging at PanicLevel is disabled.

func (*Logger) Warn

func (l *Logger) Warn(args ...interface{})

Warn logs a message at warn level

func (*Logger) WithContext

func (l *Logger) WithContext(ctx context.Context) flamingo.Logger

WithContext returns a logger with fields filled from the context businessId: From Header X-Business-ID client_ip: From Header X-Forwarded-For or request if header is empty correlationId: The ID of the context method: HTTP verb from request path: URL path from request referer: referer from request request: received payload from request

func (*Logger) WithField

func (l *Logger) WithField(key flamingo.LogKey, value interface{}) flamingo.Logger

WithField creates a child logger and adds structured context to it.

func (*Logger) WithFields

func (l *Logger) WithFields(fields map[flamingo.LogKey]interface{}) flamingo.Logger

WithFields creates a child logger and adds structured context to it.

type Module

type Module struct {
	// contains filtered or unexported fields
}

Module for logrus logging

func (*Module) Configure

func (m *Module) Configure(injector *dingo.Injector)

Configure the logrus logger as flamingo.Logger (in JSON mode kibana compatible)

func (*Module) DefaultConfig

func (m *Module) DefaultConfig() config.Map

DefaultConfig for zap log level

func (*Module) Inject

func (m *Module) Inject(config *struct {
	Area               string     `inject:"config:area"`
	JSON               bool       `inject:"config:zap.json,optional"`
	LogLevel           string     `inject:"config:zap.loglevel,optional"`
	ColoredOutput      bool       `inject:"config:zap.colored,optional"`
	DevelopmentMode    bool       `inject:"config:zap.devmode,optional"`
	SamplingEnabled    bool       `inject:"config:zap.sampling.enabled,optional"`
	SamplingInitial    float32    `inject:"config:zap.sampling.initial,optional"`
	SamplingThereafter float32    `inject:"config:zap.sampling.thereafter,optional"`
	FieldMap           config.Map `inject:"config:zap.fieldmap,optional"`
})

Inject dependencies

Jump to

Keyboard shortcuts

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