log

package
v0.0.0-...-13d8ce4 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2019 License: Apache-2.0 Imports: 6 Imported by: 15

Documentation

Index

Constants

View Source
const (
	//LogFileName is the log file prefix name
	LogFileName = "kingbus.log"
	//LogFileMaxSize is the max size of log file
	LogFileMaxSize int = 100 //MB
	//LogMaxBackups is the max backup count of log file
	LogMaxBackups = 20
	//LogMaxAge is the max time to save log file
	LogMaxAge = 28 //days
)

Variables

Log is a global var of log

View Source
var Logger *zap.Logger

Logger is a global var of zap log

Functions

func CallerEncoder

func CallerEncoder(caller zapcore.EntryCaller, enc zapcore.PrimitiveArrayEncoder)

CallerEncoder will add caller to log. format is "filename:lineNum:", e.g:"zaplog/zaplog_test.go:15"

func InitLoggers

func InitLoggers(logDir string, logLevel string)

InitLoggers the global logger.

func UnInitLoggers

func UnInitLoggers()

UnInitLoggers implements sync log before quit

Types

type Writer

type Writer struct {
	LogFunc func(msg string, fields ...zapcore.Field)
}

Writer is a interface of the web framework:echo log writer

func NewWriter

func NewWriter() *Writer

NewWriter create a Writer

func (*Writer) Write

func (l *Writer) Write(p []byte) (int, error)

Write implements the Write interface

Jump to

Keyboard shortcuts

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