zlog

package
v1.0.8 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2024 License: BSD-3-Clause Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const LayoutISO8601 = "2006-01-02T15:04:05.000Z0700"

Variables

This section is empty.

Functions

func AppendFileLog

func AppendFileLog(filename, format string, a ...interface{}) error

AppendFileLog append log to file

func CreateZapCore

func CreateZapCore(c *Config) zapcore.Core

CreateZapCore 根据配置创建zapcore.Core

func DPanic

func DPanic(args ...interface{})

func DPanicf

func DPanicf(format string, args ...interface{})

func DPanicln

func DPanicln(args ...interface{})

func DPanicw

func DPanicw(msg string, kvPairs ...interface{})

func Debug

func Debug(args ...interface{})

func Debugf

func Debugf(format string, args ...interface{})

func Debugln

func Debugln(args ...interface{})

func Debugw

func Debugw(msg string, kvPairs ...interface{})

func Error

func Error(args ...interface{})

func Errorf

func Errorf(format string, args ...interface{})

func Errorln

func Errorln(args ...interface{})

func Errorw

func Errorw(msg string, kvPairs ...interface{})

func Fatal

func Fatal(args ...interface{})

func Fatalf

func Fatalf(format string, args ...interface{})

func Fatalln

func Fatalln(args ...interface{})

func Fatalw

func Fatalw(msg string, kvPairs ...interface{})

func Info

func Info(args ...interface{})

func Infof

func Infof(format string, args ...interface{})

func Infoln

func Infoln(args ...interface{})

func Infow

func Infow(msg string, kvPairs ...interface{})

func IsTerminal

func IsTerminal(w io.Writer) bool

func Level

func Level() zapcore.Level

func Logger

func Logger() *zap.Logger

func Panic

func Panic(args ...interface{})

func Panicf

func Panicf(format string, args ...interface{})

func Panicln

func Panicln(args ...interface{})

func Panicw

func Panicw(msg string, kvPairs ...interface{})

func SetLogger

func SetLogger(log *zap.Logger)

func SetLoggerWith

func SetLoggerWith(core zapcore.Core, callerSkip int)

func Sugared

func Sugared() *zap.SugaredLogger

func Sync

func Sync() error

func Warn

func Warn(args ...interface{})

func Warnf

func Warnf(format string, args ...interface{})

func Warnln

func Warnln(args ...interface{})

func Warnw

func Warnw(msg string, kvPairs ...interface{})

func With

func With(fields ...zap.Field) *zap.Logger

Types

type Config

type Config struct {
	Level      string `json:"level"`       // DEBUG, INFO, WARN, DPANIC, PANIC, FATAL
	Encoding   string `json:"encoding"`    // "json" or "console"
	TimeLayout string `json:"time-layout"` // layout to encoding time
	Filename   string `json:"filename"`    //
	MaxSize    int    `json:"max_size"`    // defaults to 100 MB
	MaxBackups int    `json:"max_backups"` // maximum number of old log files to retain
	CallerSkip int    `json:"caller_skip"` // skip some number of extra stack frames (0 = don't skip)
}

Config 配置参数

func NewConfig

func NewConfig() *Config

func (*Config) Build

func (c *Config) Build() *zap.Logger

type Writer

type Writer struct {
	lumberjack.Logger
	// contains filtered or unexported fields
}

Writer write log to file and console

func NewWriter

func NewWriter(filename, console string, maxSize, maxBackup int) *Writer

func (*Writer) Write

func (w *Writer) Write(p []byte) (n int, err error)

Jump to

Keyboard shortcuts

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