xlog

package module
v0.0.0-...-0077577 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2023 License: MIT Imports: 6 Imported by: 0

README

xlog

  • 拉取
    go get gitee.com/xt_59420/xlog
  • 介绍

基于 zap + lumberjack 实现

Documentation

Index

Constants

View Source
const (
	// DefaultPath 默认文件名称
	DefaultPath = "./xlog.log"

	// TraceName 日志级别:TRACE
	TraceName = "TRACE"
	// DebugName 日志级别:DEBUG
	DebugName = "DEBUG"
	// InfoName 日志级别:INFO
	InfoName = "INFO"
	// WarnName 日志级别:WARN
	WarnName = "WARN"
	// ErrorName 日志级别:ERROR
	ErrorName = "ERROR"
	// PanicName 日志级别:PANIC
	PanicName = "PANIC"
	// FatalName 日志级别:FATAL
	FatalName = "FATAL"
)

Variables

This section is empty.

Functions

func Debug

func Debug(msg string, fields ...zapcore.Field)

Debug 输出DEBUG级别的日志

func Debugf

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

Debugf 带格式化输出DEBUG级别日志

func Error

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

Error 输出ERROR级别的日志

func Errorf

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

Errorf 带格式化输出ERROR级别日志

func Fatal

func Fatal(msg string, fields ...zapcore.Field)

Fatal 输出FATAL级别日志

func Fatalf

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

Fatalf 带格式化输出FATAL级别日志

func Info

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

Info 输出INFO级别的日志

func Infof

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

Infof 带格式化输出INFO级别日志

func InitLog

func InitLog(cfg Logger) error

InitLog 初始化加载log

func Panic

func Panic(msg string, fields ...zapcore.Field)

Panic 输出PANIC级别的日志

func Panicf

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

Panicf 带格式化输出PANIC级别日志

func Trace

func Trace(msg string, fields ...zapcore.Field)

Trace 输出TRACE级别的日志

func Tracef

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

Tracef 带格式化输出TRACE级别日志

func Warn

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

Warn 输出WARNING级别的日志

func Warnf

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

Warnf 带格式化输出WARNING级别日志

Types

type Logger

type Logger struct {
	Level      string `json:"level" yaml:"level"`
	FileName   string `json:"filename" yaml:"filename"`     // 文件位置
	MaxSize    int    `json:"maxsize" yaml:"maxsize"`       // 日志文件最大大小
	MaxAge     int    `json:"maxage" yaml:"maxage"`         // 最大存储天数
	MaxBackups int    `json:"maxbackups" yaml:"maxbackups"` // 最大备份数
	LocalTime  bool   `json:"localtime" yaml:"localtime"`   // 用于格式化时间戳的时间是否在
	Compress   bool   `json:"compress" yaml:"compress"`     // 是否压缩
}

Jump to

Keyboard shortcuts

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