zlog

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultLevel      = zapcore.InfoLevel
	DefaultTimeLayout = time.RFC3339
)

Variables

This section is empty.

Functions

func CreateJsonLogger

func CreateJsonLogger(opts ...Option) (interfaces.Logger, error)

Types

type Level

type Level int8
const (
	DebugLevel Level = iota - 1
	// InfoLevel is the default logging priority.
	InfoLevel
	// WarnLevel logs are more important than Info, but don't need individual
	// human review.
	WarnLevel
	// ErrorLevel logs are high-priority. If an application is running smoothly,
	// it shouldn't generate any error-level logs.
	ErrorLevel
	// DPanicLevel logs are particularly important errors. In development the
	// logger panics after writing the message.
	DPanicLevel
	// PanicLevel logs a message, then panics.
	PanicLevel
	// FatalLevel logs a message, then calls os.Exit(1).
	FatalLevel
)

type Option

type Option func(*option)

func WithFields

func WithFields(fields map[string]string) Option

WithFields 添加附加字段

func WithFile

func WithFile(filePath string, maxSize, maxBackups, maxAge int) Option

WithFile 设置日志文件

func WithLevel

func WithLevel(level Level) Option

func WithOutputInConsole

func WithOutputInConsole() Option

WithOutputInConsole 输出到控制台

func WithSeparateErrorFile

func WithSeparateErrorFile(filePath string, maxSize, maxBackups, maxAge int) Option

WithSeparateErrorFile 单独输出 错误日志

func WithTimeLayout

func WithTimeLayout(timeLayout string) Option

WithTimeLayout 设置时间格式

Jump to

Keyboard shortcuts

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