zaplog

package
v1.1.8 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Logger        *zap.Logger        // 标准打印
	SugaredLogger *zap.SugaredLogger // 类似于printf
)
View Source
var CONFIG = Zap{
	Level:            "debug",
	Format:           "console",
	Prefix:           "[go-blackbox]",
	Director:         ".",
	LinkName:         "latest_log",
	ShowLine:         true,
	EncodeLevel:      "LowercaseColorLevelEncoder",
	StacktraceKey:    "stacktrace",
	LogInConsole:     true,
	MaxAge:           7 * 24,
	WithRotationTime: 24,
}

CONFIG 基础配置

Functions

func GetWriteSyncer2 added in v1.1.2

func GetWriteSyncer2(filename string) io.Writer

GetWriteSyncer2 创建写入文件流,根据日志级别写入不同文件中 debug\info\warn\error 每个级别等级限制显示所属的内容 info\warn\error warn\error error

func Init

func Init() (err error)

Types

type Zap

type Zap struct {
	Level            string `mapstructure:"level" json:"level" yaml:"level"` //debug ,info,warn,error,panic,fatal
	Format           string `mapstructure:"format" json:"format" yaml:"format"`
	Prefix           string `mapstructure:"prefix" json:"prefix" yaml:"prefix"`
	Director         string `mapstructure:"director" json:"director"  yaml:"director"`
	LinkName         string `mapstructure:"link-name" json:"link-name" yaml:"link-name"`
	ShowLine         bool   `mapstructure:"show-line" json:"show-line" yaml:"show-line"`
	EncodeLevel      string `mapstructure:"encode-level" json:"encode-level" yaml:"encode-level"`
	StacktraceKey    string `mapstructure:"stacktrace-key" json:"stacktrace-key" yaml:"stacktrace-key"`
	LogInConsole     bool   `mapstructure:"log-in-console" json:"log-in-console" yaml:"log-in-console"`
	MaxAge           int
	WithRotationTime int
}

Jump to

Keyboard shortcuts

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