Documentation ¶
Index ¶
- Constants
- Variables
- func AddLogContext(ctx context.Context, key string, value interface{})
- func ColoredLevelName(level int) string
- func LevelName(level int) string
- type DummyEventHandler
- type Event
- type EventHandler
- type EventHandlers
- type EventSink
- type FuncEventHandler
- type FuncEventSink
- type LogContext
- type LogSite
- type Memo
Constants ¶
View Source
const LevelDebug = 20
View Source
const LevelDebugCall = 15
View Source
const LevelError = 50
LevelError is the level for user visible error
View Source
const LevelFatal = 60
LevelFatal is the level for panic or panic like scenario
View Source
const LevelInfo = 30
LevelInfo should be the production environment default
View Source
const LevelInfoCall = 25
View Source
const LevelTrace = 10
LevelTrace should be development environment default
View Source
const LevelTraceCall = 5
LevelTraceCall is lowest logging level enable this will print every TraceCall, which is a LOT
View Source
const LevelWarn = 40
LevelWarn is the level for error != nil
Variables ¶
View Source
var LogContextKey = 1010010001
View Source
var MinCallLevel = LevelDebugCall
MinCallLevel will be half level higher than MinLevel to minimize the xxxCall output
View Source
var MinLevel = LevelTrace
MinLevel exists to minimize the overhead of Trace/Debug logging
Functions ¶
func AddLogContext ¶
func ColoredLevelName ¶
Types ¶
type DummyEventHandler ¶
type DummyEventHandler struct {
Site *LogSite
}
func (*DummyEventHandler) Handle ¶
func (handler *DummyEventHandler) Handle(event *Event)
func (*DummyEventHandler) LogSite ¶
func (handler *DummyEventHandler) LogSite() *LogSite
type EventHandler ¶
type EventHandlers ¶
type EventHandlers []EventHandler
func (EventHandlers) Handle ¶
func (handlers EventHandlers) Handle(event *Event)
func (EventHandlers) LogSite ¶
func (handlers EventHandlers) LogSite() *LogSite
type EventSink ¶
type EventSink interface {
HandlerOf(site *LogSite) EventHandler
}
type FuncEventHandler ¶
type FuncEventHandler func(event *Event)
func (FuncEventHandler) Handle ¶
func (handler FuncEventHandler) Handle(event *Event)
func (FuncEventHandler) LogSite ¶
func (handler FuncEventHandler) LogSite() *LogSite
type FuncEventSink ¶
type FuncEventSink func(site *LogSite) EventHandler
func (FuncEventSink) HandlerOf ¶
func (sink FuncEventSink) HandlerOf(site *LogSite) EventHandler
type LogContext ¶
type LogContext struct { Memos [][]byte Properties []interface{} }
func GetLogContext ¶
func GetLogContext(ctx context.Context) *LogContext
Click to show internal directories.
Click to hide internal directories.