logger

package
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2023 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// WriterConsole console输出
	WriterConsole = "console"
	// WriterFile 文件输出
	WriterFile = "file"
)
View Source
const (
	// RotateTimeDaily 按天切割
	RotateTimeDaily = "daily"
	// RotateTimeHourly 按小时切割
	RotateTimeHourly = "hourly"
)

Variables

This section is empty.

Functions

func Error

func Error(msg string, fields ...zap.Field)

Error logger

func GetLogger

func GetLogger() *zap.Logger

GetLogger return a log

func Info

func Info(msg string, fields ...zap.Field)

Info logger

func Init

func Init(cfg *Config) *zap.Logger

Init init log

func Warn

func Warn(msg string, fields ...zap.Field)

Warn logger

Types

type Config

type Config struct {
	Development       bool
	DisableCaller     bool
	DisableStacktrace bool
	Encoding          string
	Level             string
	Name              string
	Writers           string
	LoggerFile        string
	LoggerWarnFile    string
	LoggerErrorFile   string
	LogFormatText     bool
	LogRollingPolicy  string
	LogBackupCount    uint
}

Config log config

type Fields

type Fields map[string]interface{}

Fields Type to pass when we want to call WithFields for structured logging

type Logger

type Logger interface {
	Info(args ...interface{})
	Warn(args ...interface{})
	Error(args ...interface{})
}

Logger is a contract for the logger

Jump to

Keyboard shortcuts

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