zaplog

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2023 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewSugerZapLogger

func NewSugerZapLogger(conf Conf) *zap.SugaredLogger

func NewZapLogger

func NewZapLogger(conf Conf) *zap.Logger

NewZapLogger 新建建zap.SugaredLogger

Types

type Conf

type Conf struct {
	Writer     Writer `yaml:"writer"`     // 日志输出方式(console-控制台输出、file-文件输出、console_file-文件控制台都输出)
	Level      string `yaml:"level"`      // 日志级别(debug、info、warn、error、dpanic、panic、fatal)
	Filename   string `yaml:"filename"`   // 日志文件的位置
	MaxBackups int    `yaml:"maxBackups"` // 保留旧文件的最大个数
	MaxAge     int    `yaml:"aaxAge"`     // 保留旧文件的最大天数
}

Conf 日志相关配置

type Writer

type Writer string

Writer 日志输出类型

const (
	// Console 输出到控制台
	Console Writer = "console"

	// File 输出到文件
	File Writer = "file"

	// ConsoleFile 同时输出到控制台和文件
	ConsoleFile Writer = "console_file"
)

Jump to

Keyboard shortcuts

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