logger

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2021 License: Apache-2.0 Imports: 6 Imported by: 10

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddHook

func AddHook(hook interface{}) error

func Configure

func Configure(config *Config, writer io.Writer)

func Debug

func Debug(args ...interface{})

func Debugf

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

func Debugln

func Debugln(args ...interface{})

func Error

func Error(args ...interface{})

func Errorf

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

func Errorln

func Errorln(args ...interface{})

func Fatal

func Fatal(args ...interface{})

func Fatalf

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

func Fatalln

func Fatalln(args ...interface{})

func GetRotatedWriter

func GetRotatedWriter(config *Config) io.Writer

func Info

func Info(args ...interface{})

func Infof

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

func Infoln

func Infoln(args ...interface{})

func Panic

func Panic(args ...interface{})

func Panicf

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

func Panicln

func Panicln(args ...interface{})

func Print

func Print(args ...interface{})

func Printf

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

func Println

func Println(args ...interface{})

func SetFormatter

func SetFormatter(formatter string)

func SetLevel

func SetLevel(level string)

func SetReportCaller

func SetReportCaller(reportCaller bool)

func SetWriter

func SetWriter(writer io.Writer)

func Trace

func Trace(args ...interface{})

func Tracef

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

func Traceln

func Traceln(args ...interface{})

func Warn

func Warn(args ...interface{})

func Warnf

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

func Warnln

func Warnln(args ...interface{})

Types

type Config

type Config struct {
	Base         string `mapstructure:"base"`
	Level        string `mapstructure:"level"`
	Format       string `mapstructure:"format"`
	Enabled      bool   `mapstructure:"enabled"`
	MaxAge       uint   `mapstructure:"max_age"` // days
	MaxBackups   uint   `mapstructure:"max_backups"`
	MaxSize      uint   `mapstructure:"max_size"` // MBs
	Compress     bool   `mapstructure:"compress"`
	ReportCaller bool   `mapstructure:"report_caller"`
	Filename     string `mapstructure:"filename"`
}

Config represents logger configuration

type Fields

type Fields map[string]interface{}

type LogEntry

type LogEntry interface {
	Debug(...interface{})
	Debugf(string, ...interface{})
	Debugln(...interface{})
	Error(...interface{})
	Errorf(string, ...interface{})
	Errorln(...interface{})
	Fatal(...interface{})
	Fatalf(string, ...interface{})
	Fatalln(...interface{})
	Info(...interface{})
	Infof(string, ...interface{})
	Infoln(...interface{})
	Trace(...interface{})
	Tracef(string, ...interface{})
	Traceln(...interface{})
	Panic(...interface{})
	Panicf(string, ...interface{})
	Panicln(...interface{})
	Print(...interface{})
	Printf(string, ...interface{})
	Println(...interface{})
	Warn(...interface{})
	Warnf(string, ...interface{})
	Warnln(...interface{})

	WithField(string, interface{}) LogEntry
	WithFields(Fields) LogEntry
	WithContext(context.Context) LogEntry
}

func NewEntry

func NewEntry() LogEntry

func WithContext

func WithContext(ctx context.Context) LogEntry

func WithField

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

func WithFields

func WithFields(fields Fields) LogEntry

type Logger

type Logger interface {
	LogEntry

	AddHook(interface{}) error
	NewEntry() LogEntry
	SetWriter(io.Writer)
	SetReportCaller(bool)
	SetLevel(string)
	SetFormatter(string)
}

Jump to

Keyboard shortcuts

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