zap

package module
v1.6.18 Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2024 License: MIT Imports: 8 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithCallerSkip

func WithCallerSkip(i int) logger.Option

func WithConfig

func WithConfig(c zap.Config) logger.Option

WithConfig pass zap.Config to logger

func WithEncoderConfig

func WithEncoderConfig(c zapcore.EncoderConfig) logger.Option

WithEncoderConfig pass zapcore.EncoderConfig to logger

func WithFileWriter

func WithFileWriter(fw FileWriter) logger.Option

func WithJSONEncode

func WithJSONEncode() logger.Option

func WithNamespace

func WithNamespace(namespace string) logger.Option

func WithWriter

func WithWriter(writer zapcore.WriteSyncer) logger.Option

Types

type FileWriter

type FileWriter struct {
	FileName   string
	MaxSize    int
	MaxBackups int
	MaxAge     int
	Compress   bool
}

type ZapLog added in v1.4.17

type ZapLog struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func New

func New(opts ...logger.Option) (*ZapLog, error)

New builds a new logger based on options

func (*ZapLog) Error added in v1.4.17

func (l *ZapLog) Error(err error) logger.Logger

func (*ZapLog) Fields added in v1.4.17

func (l *ZapLog) Fields(fields map[string]interface{}) logger.Logger

func (*ZapLog) GetLogger added in v1.4.17

func (l *ZapLog) GetLogger() *zap.Logger

func (*ZapLog) Init added in v1.4.17

func (l *ZapLog) Init(opts ...logger.Option) error

func (*ZapLog) Log added in v1.4.17

func (l *ZapLog) Log(level logger.Level, args ...interface{})

func (*ZapLog) Logf added in v1.4.17

func (l *ZapLog) Logf(level logger.Level, format string, args ...interface{})

func (*ZapLog) Options added in v1.4.17

func (l *ZapLog) Options() logger.Options

func (*ZapLog) String added in v1.4.17

func (l *ZapLog) String() string

func (*ZapLog) Sync added in v1.4.17

func (l *ZapLog) Sync() error

Jump to

Keyboard shortcuts

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