log

package
v0.0.11 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2021 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewDefaultZapLogger

func NewDefaultZapLogger(Path string) *zap.Logger

func NewZapLogger

func NewZapLogger(Path string, options ...Option) *zap.Logger

Types

type Config

type Config struct {
	MaxSize    int
	MaxBackups int
	MaxAge     int
	Compress   bool
	Path       string
}

type Log

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

func NewDefaultLog

func NewDefaultLog(path string) *Log

func NewLog

func NewLog(path string, options ...Option) *Log

func (*Log) Debug

func (p *Log) Debug(msg string, field ...zapcore.Field)

func (*Log) DebugF

func (p *Log) DebugF(msg string, keysAndValues ...interface{})

func (*Log) Error

func (p *Log) Error(msg string, field ...zapcore.Field)

func (*Log) ErrorF

func (p *Log) ErrorF(msg string, keysAndValues ...interface{})

func (*Log) Info

func (p *Log) Info(msg string, field ...zapcore.Field)

func (*Log) InfoF

func (p *Log) InfoF(msg string, keysAndValues ...interface{})

func (*Log) Warn

func (p *Log) Warn(msg string, field ...zapcore.Field)

func (*Log) WarnF

func (p *Log) WarnF(msg string, keysAndValues ...interface{})

type Logger

type Logger interface {
	LoggerF
	LoggerZap
}

Logger represents the ability to log messages, both errors and not.

type LoggerF

type LoggerF interface {
	DebugF(msg string, keysAndValues ...interface{})
	InfoF(msg string, keysAndValues ...interface{})
	WarnF(msg string, keysAndValues ...interface{})
	ErrorF(msg string, keysAndValues ...interface{})
}

LoggerF zap logger use sprintf format string

type LoggerZap

type LoggerZap interface {
	Debug(msg string, field ...zapcore.Field)
	Info(msg string, field ...zapcore.Field)
	Warn(msg string, field ...zapcore.Field)
	Error(msg string, field ...zapcore.Field)
}

LoggerZap Zap logger interface

type Option

type Option func(c *Config)

func Compress

func Compress(compress bool) Option

func MaxAge

func MaxAge(maxAge int) Option

func MaxBackups

func MaxBackups(maxBackups int) Option

func MaxSize

func MaxSize(maxSize int) Option

Jump to

Keyboard shortcuts

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