log

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2020 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Debug

func Debug(what ...interface{})

func Debugf

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

func Error

func Error(what ...interface{})

func Errorf

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

func Fatal

func Fatal(what ...interface{})

func Fatalf

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

func Info

func Info(what ...interface{})

func Infof

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

func IsDebugEnabled

func IsDebugEnabled() bool

func IsErrorEnabled

func IsErrorEnabled() bool

func IsFatalEnabled

func IsFatalEnabled() bool

func IsInfoEnabled

func IsInfoEnabled() bool

func IsTraceEnabled

func IsTraceEnabled() bool

func IsWarnEnabled

func IsWarnEnabled() bool

func SetFormat added in v0.1.0

func SetFormat(f Format) error

func SetLevel

func SetLevel(l Level) error

func Trace

func Trace(what ...interface{})

func Tracef

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

func Warn

func Warn(what ...interface{})

func Warnf

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

Types

type Format added in v0.1.0

type Format interface {
	flag.Value
	Equals(Format) bool
}

func GetFormat added in v0.1.0

func GetFormat() Format

type HasLogger

type HasLogger interface {
	Log() Logger
}

type JsonValue

type JsonValue struct {
	Value       interface{}
	PrettyPrint bool
}

func (JsonValue) String

func (instance JsonValue) String() string

type Level

type Level interface {
	flag.Value
	Equals(Level) bool
}

func GetLevel

func GetLevel() Level

type Logger

type Logger interface {
	WithField(key string, value interface{}) Logger
	WithDeepField(key string, value interface{}) Logger
	WithDeepFieldOn(key string, value interface{}, on func() bool) Logger
	WithError(err error) Logger

	Trace(what ...interface{})
	Debug(what ...interface{})
	Info(what ...interface{})
	Warn(what ...interface{})
	Error(what ...interface{})
	Fatal(what ...interface{})

	Tracef(msg string, args ...interface{})
	Debugf(msg string, args ...interface{})
	Infof(msg string, args ...interface{})
	Warnf(msg string, args ...interface{})
	Errorf(msg string, args ...interface{})
	Fatalf(msg string, args ...interface{})

	IsTraceEnabled() bool
	IsDebugEnabled() bool
	IsInfoEnabled() bool
	IsWarnEnabled() bool
	IsErrorEnabled() bool
	IsFatalEnabled() bool
}

func OrDefault

func OrDefault(in Logger) Logger

func WithDeepField

func WithDeepField(key string, value interface{}) Logger

func WithDeepFieldOn

func WithDeepFieldOn(key string, value interface{}, on func() bool) Logger

func WithError

func WithError(err error) Logger

func WithField

func WithField(key string, value interface{}) Logger

type LogrusColorMode

type LogrusColorMode string

func (*LogrusColorMode) Set

func (instance *LogrusColorMode) Set(plain string) error

func (LogrusColorMode) String

func (instance LogrusColorMode) String() string

type LogrusEntry

type LogrusEntry struct {
	Root     *LogrusLogger
	Delegate *logrus.Entry
}

func (*LogrusEntry) Debug

func (instance *LogrusEntry) Debug(what ...interface{})

func (*LogrusEntry) Debugf

func (instance *LogrusEntry) Debugf(msg string, args ...interface{})

func (*LogrusEntry) Error

func (instance *LogrusEntry) Error(what ...interface{})

func (*LogrusEntry) Errorf

func (instance *LogrusEntry) Errorf(msg string, args ...interface{})

func (*LogrusEntry) Fatal

func (instance *LogrusEntry) Fatal(what ...interface{})

func (*LogrusEntry) Fatalf

func (instance *LogrusEntry) Fatalf(msg string, args ...interface{})

func (*LogrusEntry) Info

func (instance *LogrusEntry) Info(what ...interface{})

func (*LogrusEntry) Infof

func (instance *LogrusEntry) Infof(msg string, args ...interface{})

func (*LogrusEntry) IsDebugEnabled

func (instance *LogrusEntry) IsDebugEnabled() bool

func (*LogrusEntry) IsErrorEnabled

func (instance *LogrusEntry) IsErrorEnabled() bool

func (*LogrusEntry) IsFatalEnabled

func (instance *LogrusEntry) IsFatalEnabled() bool

func (*LogrusEntry) IsInfoEnabled

func (instance *LogrusEntry) IsInfoEnabled() bool

func (*LogrusEntry) IsTraceEnabled

func (instance *LogrusEntry) IsTraceEnabled() bool

func (*LogrusEntry) IsWarnEnabled

func (instance *LogrusEntry) IsWarnEnabled() bool

func (*LogrusEntry) Trace

func (instance *LogrusEntry) Trace(what ...interface{})

func (*LogrusEntry) Tracef

func (instance *LogrusEntry) Tracef(msg string, args ...interface{})

func (*LogrusEntry) Warn

func (instance *LogrusEntry) Warn(what ...interface{})

func (*LogrusEntry) Warnf

func (instance *LogrusEntry) Warnf(msg string, args ...interface{})

func (*LogrusEntry) WithDeepField

func (instance *LogrusEntry) WithDeepField(key string, value interface{}) Logger

func (*LogrusEntry) WithDeepFieldOn

func (instance *LogrusEntry) WithDeepFieldOn(key string, value interface{}, on func() bool) Logger

func (*LogrusEntry) WithError

func (instance *LogrusEntry) WithError(err error) Logger

func (*LogrusEntry) WithField

func (instance *LogrusEntry) WithField(key string, value interface{}) Logger

type LogrusFormat

type LogrusFormat string

func (*LogrusFormat) Equals added in v0.1.0

func (instance *LogrusFormat) Equals(o Format) bool

func (*LogrusFormat) Set

func (instance *LogrusFormat) Set(plain string) error

func (LogrusFormat) String

func (instance LogrusFormat) String() string

type LogrusLevel

type LogrusLevel struct {
	logrus.Level
}

func (*LogrusLevel) Equals

func (instance *LogrusLevel) Equals(o Level) bool

func (*LogrusLevel) Set

func (instance *LogrusLevel) Set(plain string) error

func (LogrusLevel) String

func (instance LogrusLevel) String() string

type LogrusLogger

type LogrusLogger struct {
	Level              *LogrusLevel
	Format             LogrusFormat
	ColorMode          LogrusColorMode
	ReportCaller       bool
	Delegate           *logrus.Logger
	EntryLoggerFactory func(*logrus.Logger) Logger
}

func (*LogrusLogger) CreateEntryLogger

func (instance *LogrusLogger) CreateEntryLogger() Logger

func (*LogrusLogger) Debug

func (instance *LogrusLogger) Debug(what ...interface{})

func (*LogrusLogger) Debugf

func (instance *LogrusLogger) Debugf(msg string, args ...interface{})

func (*LogrusLogger) Error

func (instance *LogrusLogger) Error(what ...interface{})

func (*LogrusLogger) Errorf

func (instance *LogrusLogger) Errorf(msg string, args ...interface{})

func (*LogrusLogger) Fatal

func (instance *LogrusLogger) Fatal(what ...interface{})

func (*LogrusLogger) Fatalf

func (instance *LogrusLogger) Fatalf(msg string, args ...interface{})

func (*LogrusLogger) Flags

func (instance *LogrusLogger) Flags() []cli.Flag

func (*LogrusLogger) GetFormat added in v0.1.0

func (instance *LogrusLogger) GetFormat() Format

func (*LogrusLogger) GetLevel

func (instance *LogrusLogger) GetLevel() Level

func (*LogrusLogger) Info

func (instance *LogrusLogger) Info(what ...interface{})

func (*LogrusLogger) Infof

func (instance *LogrusLogger) Infof(msg string, args ...interface{})

func (*LogrusLogger) Init

func (instance *LogrusLogger) Init() error

func (*LogrusLogger) IsDebugEnabled

func (instance *LogrusLogger) IsDebugEnabled() bool

func (*LogrusLogger) IsErrorEnabled

func (instance *LogrusLogger) IsErrorEnabled() bool

func (*LogrusLogger) IsFatalEnabled

func (instance *LogrusLogger) IsFatalEnabled() bool

func (*LogrusLogger) IsInfoEnabled

func (instance *LogrusLogger) IsInfoEnabled() bool

func (*LogrusLogger) IsTraceEnabled

func (instance *LogrusLogger) IsTraceEnabled() bool

func (*LogrusLogger) IsWarnEnabled

func (instance *LogrusLogger) IsWarnEnabled() bool

func (*LogrusLogger) SetFormat added in v0.1.0

func (instance *LogrusLogger) SetFormat(l Format) error

func (*LogrusLogger) SetLevel

func (instance *LogrusLogger) SetLevel(l Level) error

func (*LogrusLogger) Trace

func (instance *LogrusLogger) Trace(what ...interface{})

func (*LogrusLogger) Tracef

func (instance *LogrusLogger) Tracef(msg string, args ...interface{})

func (*LogrusLogger) Warn

func (instance *LogrusLogger) Warn(what ...interface{})

func (*LogrusLogger) Warnf

func (instance *LogrusLogger) Warnf(msg string, args ...interface{})

func (*LogrusLogger) WithDeepField

func (instance *LogrusLogger) WithDeepField(key string, value interface{}) Logger

func (*LogrusLogger) WithDeepFieldOn

func (instance *LogrusLogger) WithDeepFieldOn(key string, value interface{}, on func() bool) Logger

func (*LogrusLogger) WithError

func (instance *LogrusLogger) WithError(err error) Logger

func (*LogrusLogger) WithField

func (instance *LogrusLogger) WithField(key string, value interface{}) Logger

type RootLogger

type RootLogger interface {
	Logger

	Init() error
	Flags() []cli.Flag
	GetLevel() Level
	SetLevel(Level) error
	GetFormat() Format
	SetFormat(Format) error
}
var DefaultLogger RootLogger = &LogrusLogger{
	Level:     &LogrusLevel{logrus.InfoLevel},
	Format:    "text",
	ColorMode: "auto",
	Delegate:  logrus.New(),
}

Jump to

Keyboard shortcuts

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