logger

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2021 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DebugLevel  = zap.DebugLevel
	InfoLevel   = zap.InfoLevel
	WarnLevel   = zap.WarnLevel
	ErrorLevel  = zap.ErrorLevel
	DPanicLevel = zap.DPanicLevel
	PanicLevel  = zap.PanicLevel
	FatalLevel  = zap.FatalLevel
)
View Source
const (
	LOGGER_TEXT = iota
	LOGGER_JSON
)
View Source
const (
	CONF_XML  = ".xml"
	CONF_JSON = ".json"
	CONF_YAML = ".yaml"
	CONF_TOML = ".toml"
)

Variables

View Source
var Any = zap.Any
View Source
var Binary = zap.Binary
View Source
var Bool = zap.Bool
View Source
var Boolp = zap.Boolp
View Source
var ByteString = zap.ByteString
View Source
var Complex128 = zap.Complex128
View Source
var Complex128p = zap.Complex128p
View Source
var Complex64 = zap.Complex64
View Source
var Complex64p = zap.Complex64p
View Source
var DefaultFuncLog = loggerConfig{Filter: []filter{
	{Enabled: true, Tag: "file", Level: "DEBUG", Type: "file", Mode: "JSON", Property: []property{
		{Name: "filename", Value: "./log/func.log"},
		{Name: "maxbackups", Value: "10"},
		{Name: "maxage", Value: "7"},
		{Name: "maxsize", Value: "1024"},
		{Name: "compress", Value: "true"},
		{Name: "localtime", Value: "true"},
	}},
}}
View Source
var DefaultSysLog = loggerConfig{Filter: []filter{
	{Enabled: true, Tag: "stdout", Level: "DEBUG", Type: "console", Mode: "TEXT"},
	{Enabled: false, Tag: "file", Level: "INFO", Type: "file", Mode: "JSON", Property: []property{
		{Name: "filename", Value: "./log/info.log"},
		{Name: "maxbackups", Value: "10"},
		{Name: "maxage", Value: "7"},
		{Name: "maxsize", Value: "1024"},
		{Name: "compress", Value: "true"},
		{Name: "localtime", Value: "true"},
	}},
	{Enabled: true, Tag: "file", Level: "WARN", Type: "file", Mode: "JSON", Property: []property{
		{Name: "filename", Value: "./log/warn.log"},
		{Name: "maxbackups", Value: "10"},
		{Name: "maxage", Value: "7"},
		{Name: "maxsize", Value: "1024"},
		{Name: "compress", Value: "true"},
		{Name: "localtime", Value: "true"},
	}},
	{Enabled: true, Tag: "file", Level: "ERROR", Type: "file", Mode: "JSON", Property: []property{
		{Name: "filename", Value: "./log/error.log"},
		{Name: "maxbackups", Value: "10"},
		{Name: "maxage", Value: "7"},
		{Name: "maxsize", Value: "1024"},
		{Name: "compress", Value: "true"},
		{Name: "localtime", Value: "true"},
	}},
}}
View Source
var Duration = zap.Duration
View Source
var Durationp = zap.Durationp
View Source
var Float32 = zap.Float32
View Source
var Float32p = zap.Float32p
View Source
var Float32s = zap.Float32s
View Source
var Float64 = zap.Float64
View Source
var Float64p = zap.Float64p
View Source
var Int = zap.Int
View Source
var Int16 = zap.Int16
View Source
var Int16p = zap.Int16p
View Source
var Int32 = zap.Int32
View Source
var Int32p = zap.Int32p
View Source
var Int64 = zap.Int64
View Source
var Int64p = zap.Int64p
View Source
var Int8 = zap.Int8
View Source
var Int8p = zap.Int8p
View Source
var Intp = zap.Intp
View Source
var Namespace = zap.Namespace
View Source
var Object = zap.Object
View Source
var Reflect = zap.Reflect
View Source
var Skip = zap.Skip
View Source
var Stack = zap.Stack
View Source
var StackSkip = zap.StackSkip
View Source
var String = zap.String
View Source
var Stringer = zap.Stringer
View Source
var Stringp = zap.Stringp
View Source
var Time = zap.Time
View Source
var Timep = zap.Timep
View Source
var Uint = zap.Uint
View Source
var Uint16 = zap.Uint16
View Source
var Uint16p = zap.Uint16p
View Source
var Uint32 = zap.Uint32
View Source
var Uint32p = zap.Uint32p
View Source
var Uint64 = zap.Uint64
View Source
var Uint64p = zap.Uint64p
View Source
var Uint8 = zap.Uint8
View Source
var Uint8p = zap.Uint8p
View Source
var Uintp = zap.Uintp
View Source
var Uintptr = zap.Uintptr
View Source
var Uintptrp = zap.Uintptrp

Functions

func InitLogger

func InitLogger(conf string)

func InitLoggerConsole

func InitLoggerConsole(lvl zapcore.Level)

InitLoggerConsole 日志输出到终端

Types

type Logger

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

func GetLogger

func GetLogger() *Logger

func NewLogger

func NewLogger(conf string) *Logger

func (*Logger) LoadConfiguration

func (l *Logger) LoadConfiguration(filename string)

Load XML configuration; see examples/example.xml for documentation

func (*Logger) StopLogger

func (l *Logger) StopLogger()

Jump to

Keyboard shortcuts

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