logs

package
v0.2.3 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2021 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LevelEmergency = iota
	LevelAlert
	LevelCritical
	LevelError
	LevelWarning
	LevelNotice
	LevelInformational
	LevelDebug
)

RFC5424 log message levels.

View Source
const (
	LevelInfo  = LevelInformational
	LevelTrace = LevelDebug
	LevelWarn  = LevelWarning
)

Legacy log level constants to ensure backwards compatibility.

View Source
const (
	AdapterConsole = "console"
	AdapterFile    = "file"
)

Name for adapter with beego official support

Variables

This section is empty.

Functions

func Register

func Register(name string, log newLoggerFunc)

Register makes a log provide available by the provided name. If Register is called twice with the same name or if driver is nil, it panics.

Types

type BeeLogger

type BeeLogger struct {
	// contains filtered or unexported fields
}

BeeLogger is default logger in beego application. it can contain several providers and log message into all providers.

func NewLogger

func NewLogger(channelLens ...int64) *BeeLogger

NewLogger returns a new BeeLogger. channelLen means the number of messages in chan(used where asynchronous is true). if the buffering chan is full, logger adapters write to file or other way.

func (*BeeLogger) Alert

func (bl *BeeLogger) Alert(data map[string]interface{})

Alert Log ALERT level message.

func (*BeeLogger) Async

func (bl *BeeLogger) Async(msgLen ...int64) *BeeLogger

Async set the log to asynchronous and start the goroutine

func (*BeeLogger) Close

func (bl *BeeLogger) Close()

Close close logger, flush all chan data and destroy all adapters in BeeLogger.

func (*BeeLogger) Critical

func (bl *BeeLogger) Critical(data map[string]interface{})

Critical Log CRITICAL level message.

func (*BeeLogger) Debug

func (bl *BeeLogger) Debug(data map[string]interface{})

Debug Log DEBUG level message.

func (*BeeLogger) DelLogger

func (bl *BeeLogger) DelLogger(adapterName string) error

DelLogger remove a logger adapter in BeeLogger.

func (*BeeLogger) Emergency

func (bl *BeeLogger) Emergency(data map[string]interface{})

Emergency Log EMERGENCY level message.

func (*BeeLogger) EnableFuncCallDepth

func (bl *BeeLogger) EnableFuncCallDepth(b bool)

EnableFuncCallDepth enable log funcCallDepth

func (*BeeLogger) Error

func (bl *BeeLogger) Error(data map[string]interface{})

Error Log ERROR level message.

func (*BeeLogger) Flush

func (bl *BeeLogger) Flush()

Flush flush all chan data.

func (*BeeLogger) GetLevel

func (bl *BeeLogger) GetLevel() int

GetLevel Get Current log message level.

func (*BeeLogger) GetLogFuncCallDepth

func (bl *BeeLogger) GetLogFuncCallDepth() int

GetLogFuncCallDepth return log funcCallDepth for wrapper

func (*BeeLogger) Info

func (bl *BeeLogger) Info(data map[string]interface{})

Info Log INFO level message. compatibility alias for Informational()

func (*BeeLogger) Informational

func (bl *BeeLogger) Informational(data map[string]interface{})

Informational Log INFORMATIONAL level message.

func (*BeeLogger) Notice

func (bl *BeeLogger) Notice(data map[string]interface{})

Notice Log NOTICE level message.

func (*BeeLogger) Reset

func (bl *BeeLogger) Reset()

Reset close all outputs, and set bl.outputs to nil

func (*BeeLogger) SetLevel

func (bl *BeeLogger) SetLevel(l int)

SetLevel Set log message level. If message level (such as LevelDebug) is higher than logger level (such as LevelWarning), log providers will not even be sent the message.

func (*BeeLogger) SetLogFuncCallDepth

func (bl *BeeLogger) SetLogFuncCallDepth(d int)

SetLogFuncCallDepth set log funcCallDepth

func (*BeeLogger) SetLogger

func (bl *BeeLogger) SetLogger(adapterName string, configs ...string) error

SetLogger provides a given logger adapter into BeeLogger with config string. config need to be correct JSON as string: {"interval":360}.

func (*BeeLogger) SetPrefix

func (bl *BeeLogger) SetPrefix(s string)

set prefix

func (*BeeLogger) Trace

func (bl *BeeLogger) Trace(data map[string]interface{})

Trace Log TRACE level message. compatibility alias for Debug()

func (*BeeLogger) Warn

func (bl *BeeLogger) Warn(data map[string]interface{})

Warn Log WARN level message. compatibility alias for Warning()

func (*BeeLogger) Warning

func (bl *BeeLogger) Warning(data map[string]interface{})

Warning Log WARNING level message.

type Logger

type Logger interface {
	Init(config string) error
	WriteMsg(when time.Time, msg map[string]interface{}, level int) error
	Destroy()
	Flush()
}

Logger defines the behavior of a log provider.

func NewConsole

func NewConsole() Logger

NewConsole create ConsoleWriter returning as LoggerInterface.

Jump to

Keyboard shortcuts

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