elog

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

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

Go to latest
Published: Jul 14, 2022 License: Apache-2.0 Imports: 10 Imported by: 0

README

elog

install

go get github.com/et-zone/elog

Documentation

Index

Constants

View Source
const (
	MaxAgeThreeDay = time.Hour * time.Duration(3*24)
	MaxAgeWeek     = time.Hour * time.Duration(7*24)
	MaxAgeMonth    = time.Hour * time.Duration(30*24)
	CutTimeHour    = time.Hour * time.Duration(1)
	CutTimeDay     = time.Hour * time.Duration(24)
)

Variables

This section is empty.

Functions

func Close

func Close()

func Debug

func Debug(args ...interface{})

func Debugf

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

func Error

func Error(args ...interface{})

func Errorf

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

func GetConsoleEncoder

func GetConsoleEncoder() zapcore.Encoder

GetConsoleEncoder 输出日志到控制台

func Info

func Info(args ...interface{})

func Infof

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

func Init

func Init(cfg *Config) error

func Test

func Test(t *testing.T)

func Warn

func Warn(args ...interface{})

func Warnf

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

Types

type Config

type Config struct {
	FileName string //pathName
	Level    Level
	MaxAge   time.Duration //max save time
	CutTime  time.Duration //cut time
}

type Level

type Level zapcore.Level
const (
	// DebugLevel logs are typically voluminous, and are usually disabled in
	// production.
	DebugLevel Level = iota - 1
	// InfoLevel is the default logging priority.
	InfoLevel
	// WarnLevel logs are more important than Info, but don't need individual
	// human review.
	WarnLevel
	// ErrorLevel logs are high-priority. If an application is running smoothly,
	// it shouldn't generate any error-level logs.
	ErrorLevel
	// DPanicLevel logs are particularly important errors. In development the
	// logger panics after writing the message.
	DPanicLevel
	// PanicLevel logs a message, then panics.
	PanicLevel
	// FatalLevel logs a message, then calls os.Exit(1).
	FatalLevel
)

type Log

type Log struct {
	*zap.SugaredLogger
	// contains filtered or unexported fields
}

func NewLog

func NewLog(cfg *Config) *Log

Jump to

Keyboard shortcuts

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