Documentation ¶
Index ¶
- Variables
- func Debug(msg string, opts ...Options) error
- func Error(msg string, opts ...Options) error
- func Fatal(msg string, opts ...Options) error
- func FieldsFromContext(ctx context.Context) map[string]interface{}
- func Info(msg string, opts ...Options) error
- func InjectContext(ctx context.Context, logger Logger) context.Context
- func InjectFieldsContext(ctx context.Context, fields map[string]interface{}) context.Context
- func SetDefault(logger Logger)
- func SetLevel(level Level)
- func Trace(msg string, opts ...Options) error
- func Warning(msg string, opts ...Options) error
- type ChainLogger
- type Config
- type Level
- type Logger
- type LoggerFactory
- type LogrusLogger
- type MessageLog
- type Option
- type Options
- func WithContext(ctx context.Context) Options
- func WithError(err error) Options
- func WithField(key string, value interface{}) Options
- func WithFields(fields map[string]interface{}) Options
- func WithLogger(logger Logger) Options
- func WithTime(t time.Time) Options
- func WithValues(v ...interface{}) Options
- type OptionsFunc
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ErrNoLogger = errors.New("no logger available")
)
Functions ¶
func FieldsFromContext ¶
func InjectFieldsContext ¶
func SetDefault ¶
func SetDefault(logger Logger)
Types ¶
type ChainLogger ¶
type ChainLogger struct {
// contains filtered or unexported fields
}
func (*ChainLogger) Log ¶
func (l *ChainLogger) Log(level Level, msg *MessageLog)
func (*ChainLogger) SetLevel ¶
func (l *ChainLogger) SetLevel(level Level)
type Config ¶
type Config struct {
Level int `mapstructure:"level"`
}
Config hold logger configuration
func LoadConfig ¶
LoadConfig help you to load logger's config from the general config
type Logger ¶
type Logger interface { api.Module SetLevel(level Level) Log(level Level, msg *MessageLog) }
Logger represent any logging capable
func FromContext ¶
type LoggerFactory ¶
type LoggerFactory func() Logger
type LogrusLogger ¶
type LogrusLogger struct {
// contains filtered or unexported fields
}
func NewLogrusLogger ¶
func NewLogrusLogger() *LogrusLogger
func (*LogrusLogger) Log ¶
func (l *LogrusLogger) Log(level Level, msg *MessageLog)
func (*LogrusLogger) SetLevel ¶
func (l *LogrusLogger) SetLevel(level Level)
type MessageLog ¶
type MessageLog struct {
// contains filtered or unexported fields
}
MessageLog hold message to be logged
type Options ¶
type Options interface {
Configure(o *Option)
}
func WithContext ¶
WithContext decorate current message option to include a context maybe override the logger option
func WithFields ¶
WithFileds adds all parameter fields for decorate current message option
func WithLogger ¶
WithLogger decorate message option to use specific logger
func WithValues ¶
func WithValues(v ...interface{}) Options
WithValues decorate message option to use Printf style formatting
type OptionsFunc ¶
type OptionsFunc func(o *Option)
func (OptionsFunc) Configure ¶
func (f OptionsFunc) Configure(o *Option)
Click to show internal directories.
Click to hide internal directories.