log

package
v0.1.3-dc97f77 Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2025 License: Apache-2.0 Imports: 5 Imported by: 2 modules, 2 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Debugf

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

Debugf debug日志

func Errorf

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

Errorf Error日志

func Fatalf

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

Fatalf Fatal日志

func Infof

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

Infof info日志

func InitLog

func InitLog(std bool, level string, cfgs ...Config) error

InitLog 初始化日志

func InitLogCore

func InitLogCore(std bool, level string, cfgs ...Config) (*zap.SugaredLogger, error)

func Log

func Log() *zap.SugaredLogger

func Panicf

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

Panicf Panic日志

func Warnf

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

Warnf Warn日志

Types

type Config

type Config struct {
	Enable     bool    `json:"enable" mapstructure:"enable"`
	Filename   string  `json:"filename" mapstructure:"filename"` // 日志文件名
	Level      string  `json:"level" mapstructure:"level"`       // 日志等级
	LevelOp    LevelOp `json:"level_op" mapstructure:"level_op"`
	MaxSize    int     `json:"max_size" mapstructure:"max_size"`       // 日志切割大小,m为单位
	MaxBackups int     `json:"max_backups" mapstructure:"max_backups"` // 日志最大保留个数
	MaxAge     int     `json:"max_age" mapstructure:"max_age"`         // 日志最大保留天数
}

Config 日志文件配置

type LevelOp

type LevelOp int32
const (
	LevelLT LevelOp = -2 // less than
	LevelLE LevelOp = -1 // less equal
	LevelGE LevelOp = 0  // great equal
	LevelEQ LevelOp = 1  // equal
	LevelGT LevelOp = 2  // great than
)

Jump to

Keyboard shortcuts

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