Z

package
v0.0.0-...-4d56abb Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2022 License: MIT Imports: 6 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultOpts = []zap.Option{
	zap.AddCaller(),
}

Functions

func FromL

func FromL(l L.L) *zap.SugaredLogger

func New

func New(cfg Config, f func(*zap.Config), zopts []zap.Option) (*zap.SugaredLogger, error)

New returns a new Zap logger based on the given configuration.

func Z

If z is nil, nop logger is returned. Otherwise z is returned.

Types

type ApacheLogWriter

type ApacheLogWriter struct {
	Z *zap.SugaredLogger

	// True will report regular access as Info, False as Debug.
	InfoLevel bool
}

ApacheLogWriter implements an io.Writer interface to be used as a sink for logging.

func (*ApacheLogWriter) Write

func (l *ApacheLogWriter) Write(bs []byte) (int, error)

type Config

type Config struct {
	// Minimal log level to be emitted.
	Level string `envconfig:"LEVEL" default:"info" json:"level"`

	// Dev determines log output format. True for human readable (appropiate
	// for console output), and False for machine readable (appropiate for
	// automated consumption as a JSON blob).
	Dev bool `envconfig:"DEV" default:"true" json:"dev"`

	ErrorStackTrace bool
}

Zap logger configuration.

type ZL

type ZL struct{ Z *zap.SugaredLogger }

func NewL

func NewL(cfg Config, f func(*zap.Config), zopts []zap.Option) (*ZL, error)

func (*ZL) DPanic

func (zl *ZL) DPanic(s string, args ...interface{})

func (*ZL) DPanicf

func (zl *ZL) DPanicf(s string, args ...interface{})

func (*ZL) Debug

func (zl *ZL) Debug(s string, args ...interface{})

func (*ZL) Debugf

func (zl *ZL) Debugf(s string, args ...interface{})

func (*ZL) Error

func (zl *ZL) Error(s string, args ...interface{})

func (*ZL) Errorf

func (zl *ZL) Errorf(s string, args ...interface{})

func (*ZL) Fatal

func (zl *ZL) Fatal(s string, args ...interface{})

func (*ZL) Fatalf

func (zl *ZL) Fatalf(s string, args ...interface{})

func (*ZL) Info

func (zl *ZL) Info(s string, args ...interface{})

func (*ZL) Infof

func (zl *ZL) Infof(s string, args ...interface{})

func (*ZL) Named

func (zl *ZL) Named(n string) L.L

func (*ZL) Panic

func (zl *ZL) Panic(s string, args ...interface{})

func (*ZL) Panicf

func (zl *ZL) Panicf(s string, args ...interface{})

func (*ZL) SkipCaller

func (zl *ZL) SkipCaller(i int) L.L

func (*ZL) Warn

func (zl *ZL) Warn(s string, args ...interface{})

func (*ZL) Warnf

func (zl *ZL) Warnf(s string, args ...interface{})

func (*ZL) With

func (zl *ZL) With(vs ...interface{}) L.L

Jump to

Keyboard shortcuts

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