log

package module
v0.5.3 Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2020 License: MIT Imports: 14 Imported by: 48

Documentation

Index

Constants

View Source
const (
	LevelTrace = Level(1000)
	LevelDebug = Level(2000)
	LevelInfo  = Level(3000)
	LevelWarn  = Level(4000)
	LevelError = Level(5000)
	LevelFatal = Level(6000)
)
View Source
const (
	GlobalLoggerName = "global"
)

Variables

This section is empty.

Functions

func Debug

func Debug(args ...interface{})

func Debugf

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

func Error

func Error(args ...interface{})

func Errorf

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

func Fatal

func Fatal(args ...interface{})

func Fatalf

func Fatalf(format string, args ...interface{})

func GetErrorOf

func GetErrorOf(e Event, using Provider) error

func GetLoggerOf

func GetLoggerOf(e Event, using Provider) *string

func GetMessageOf

func GetMessageOf(e Event, using Provider) *string

func GetTimestampOf

func GetTimestampOf(e Event, using Provider) *time.Time

func Info

func Info(args ...interface{})

func Infof

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

func IsDebugEnabled

func IsDebugEnabled() bool

func IsErrorEnabled

func IsErrorEnabled() bool

func IsFatalEnabled

func IsFatalEnabled() bool

func IsInfoEnabled

func IsInfoEnabled() bool

func IsLevelEnabled

func IsLevelEnabled(level Level) bool

func IsTraceEnabled

func IsTraceEnabled() bool

func IsWarnEnabled

func IsWarnEnabled() bool

func SetProvider

func SetProvider(p Provider)

func Trace

func Trace(args ...interface{})

func Tracef

func Tracef(format string, args ...interface{})

func Warn

func Warn(args ...interface{})

func Warnf

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

Types

type CoreLogger

type CoreLogger interface {
	GetName() string
	Log(Event)
	IsLevelEnabled(Level) bool
	GetProvider() Provider
}

func UnwrapCore added in v0.3.0

func UnwrapCore(in CoreLogger) CoreLogger

type Event

type Event interface {
	GetLevel() Level
	GetCallDepth() int
	GetContext() interface{}
	GetFields() fields.Fields

	With(key string, value interface{}) Event
	Withf(key string, format string, args ...interface{}) Event
	Without(keys ...string) Event
	WithFields(f fields.Fields) Event
	WithCallDepth(int) Event
}

type EventImpl

type EventImpl struct {
	Fields    fields.Fields
	Level     Level
	CallDepth int
	Context   interface{}
}

func NewEvent

func NewEvent(level Level, f fields.Fields, callDepth int) *EventImpl

func (*EventImpl) GetCallDepth

func (instance *EventImpl) GetCallDepth() int

func (*EventImpl) GetContext

func (instance *EventImpl) GetContext() interface{}

func (*EventImpl) GetFields added in v0.4.0

func (instance *EventImpl) GetFields() fields.Fields

func (*EventImpl) GetLevel

func (instance *EventImpl) GetLevel() Level

func (*EventImpl) With added in v0.4.0

func (instance *EventImpl) With(key string, value interface{}) Event

func (*EventImpl) WithCallDepth added in v0.5.0

func (instance *EventImpl) WithCallDepth(add int) Event

func (*EventImpl) WithFields added in v0.4.0

func (instance *EventImpl) WithFields(f fields.Fields) Event

func (*EventImpl) Withf added in v0.4.0

func (instance *EventImpl) Withf(key string, format string, args ...interface{}) Event

func (*EventImpl) Without added in v0.4.0

func (instance *EventImpl) Without(keys ...string) Event

type Level

type Level uint16

func (Level) CompareTo

func (instance Level) CompareTo(o Level) int

type LevelProvider

type LevelProvider func() []Level
var DefaultLevelProvider LevelProvider = func() []Level {
	return []Level{LevelTrace, LevelDebug, LevelInfo, LevelWarn, LevelError, LevelFatal}
}

type Levels

type Levels []Level

func (Levels) Len

func (instance Levels) Len() int

func (Levels) Less

func (instance Levels) Less(i, j int) bool

func (Levels) Swap

func (instance Levels) Swap(i, j int)

type Logger

type Logger interface {
	CoreLogger

	Trace(...interface{})
	Tracef(string, ...interface{})
	IsTraceEnabled() bool

	Debug(...interface{})
	Debugf(string, ...interface{})
	IsDebugEnabled() bool

	Info(...interface{})
	Infof(string, ...interface{})
	IsInfoEnabled() bool

	Warn(...interface{})
	Warnf(string, ...interface{})
	IsWarnEnabled() bool

	Error(...interface{})
	Errorf(string, ...interface{})
	IsErrorEnabled() bool

	Fatal(...interface{})
	Fatalf(string, ...interface{})
	IsFatalEnabled() bool

	With(name string, value interface{}) Logger
	Withf(name string, format string, args ...interface{}) Logger
	WithError(error) Logger
	WithFields(fields.Fields) Logger
}

func GetGlobalLogger added in v0.1.6

func GetGlobalLogger() Logger

func GetLogger

func GetLogger(name string) Logger

func NewLogger

func NewLogger(cl CoreLogger) Logger

func NewLoggerFacade added in v0.3.0

func NewLoggerFacade(provider func() CoreLogger) Logger

func Unwrap added in v0.2.0

func Unwrap(in Logger) Logger

func With

func With(name string, value interface{}) Logger

func WithError

func WithError(err error) Logger

func WithFields

func WithFields(fields fields.Fields) Logger

func Withf added in v0.1.3

func Withf(name string, format string, args ...interface{}) Logger

type LoggerCache added in v0.4.0

type LoggerCache interface {
	GetLogger(name string) Logger
}

func NewLoggerCache added in v0.4.0

func NewLoggerCache(factory LoggerFactory) LoggerCache

type LoggerFactory added in v0.4.0

type LoggerFactory func(name string) Logger

type LoggingWriter added in v0.3.0

type LoggingWriter struct {
	CoreLogger
	LogAs Level
}

func (*LoggingWriter) Write added in v0.3.0

func (instance *LoggingWriter) Write(p []byte) (n int, err error)

type Provider

type Provider interface {
	GetName() string
	GetLogger(name string) Logger
	GetAllLevels() []Level
	GetFieldKeySpec() fields.KeysSpec
}

func AllProviders

func AllProviders() []Provider

func GetProvider

func GetProvider() Provider

func NewProviderFacade added in v0.3.0

func NewProviderFacade(provider func() Provider) Provider

func RegisterProvider

func RegisterProvider(p Provider) Provider

func UnregisterProvider

func UnregisterProvider(name string) Provider

func UnwrapProvider added in v0.2.0

func UnwrapProvider(in Provider) Provider

Directories

Path Synopsis
internal
native module
std

Jump to

Keyboard shortcuts

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