Documentation ¶
Index ¶
- Constants
- Variables
- func ContextWithField(parent context.Context, k string, v interface{}) context.Context
- func ContextWithFields(parent context.Context, fs Fields) context.Context
- func Debug(v ...interface{})
- func DebugC(ctx context.Context, v ...interface{})
- func DebugCf(ctx context.Context, format string, v ...interface{})
- func Debugf(format string, v ...interface{})
- func Error(v ...interface{})
- func ErrorC(ctx context.Context, v ...interface{})
- func ErrorCf(ctx context.Context, format string, v ...interface{})
- func Errorf(format string, v ...interface{})
- func Fatal(v ...interface{})
- func FatalC(ctx context.Context, v ...interface{})
- func FatalCf(ctx context.Context, format string, v ...interface{})
- func Fatalf(format string, v ...interface{})
- func FlagInit()
- func Info(v ...interface{})
- func InfoC(ctx context.Context, v ...interface{})
- func InfoCf(ctx context.Context, format string, v ...interface{})
- func Infof(format string, v ...interface{})
- func SetDefaultLogger()
- func SetLogger(l Logger)
- func Warn(v ...interface{})
- func WarnC(ctx context.Context, v ...interface{})
- func WarnCf(ctx context.Context, format string, v ...interface{})
- func Warnf(format string, v ...interface{})
- func WithField(k, v string)
- func WithFields(fs Fields)
- type Configuration
- type Fields
- type Logger
- type LoggerSetter
- type Logrus
- func (l *Logrus) Debug(v ...interface{})
- func (l *Logrus) DebugC(ctx context.Context, v ...interface{})
- func (l *Logrus) DebugCf(ctx context.Context, format string, v ...interface{})
- func (l *Logrus) Debugf(format string, v ...interface{})
- func (l *Logrus) Error(v ...interface{})
- func (l *Logrus) ErrorC(ctx context.Context, v ...interface{})
- func (l *Logrus) ErrorCf(ctx context.Context, format string, v ...interface{})
- func (l *Logrus) Errorf(format string, v ...interface{})
- func (l *Logrus) Fatal(v ...interface{})
- func (l *Logrus) FatalC(ctx context.Context, v ...interface{})
- func (l *Logrus) FatalCf(ctx context.Context, format string, v ...interface{})
- func (l *Logrus) Fatalf(format string, v ...interface{})
- func (l *Logrus) Info(v ...interface{})
- func (l *Logrus) InfoC(ctx context.Context, v ...interface{})
- func (l *Logrus) InfoCf(ctx context.Context, format string, v ...interface{})
- func (l *Logrus) Infof(format string, v ...interface{})
- func (l *Logrus) Warn(v ...interface{})
- func (l *Logrus) WarnC(ctx context.Context, v ...interface{})
- func (l *Logrus) WarnCf(ctx context.Context, format string, v ...interface{})
- func (l *Logrus) Warnf(format string, v ...interface{})
- func (l *Logrus) WithField(k string, v interface{})
- func (l *Logrus) WithFields(fs Fields)
- func (l *Logrus) Write(b []byte) (n int, err error)
- type Writer
- type WriterFunc
Constants ¶
View Source
const ( FormatJSON = "json" FormatText = "text" )
Formats
View Source
const ( OutFile = "file" OutStdOut = "stdout" OutSyslog = "syslog" )
Outs
Variables ¶
View Source
var ( AppName = flag.String("logger-app-name", "", "the logger's app name") Filename = flag.String("logger-filename", "", "the logger's filename") Verbose = flag.Bool("logger-verbose", false, "if true, then log level is debug") )
Flags
Functions ¶
func ContextWithField ¶
func WithFields ¶
func WithFields(fs Fields)
Types ¶
type Configuration ¶
type Configuration struct { AppName string `toml:"app_name"` DisableColors bool `toml:"disable_colors"` DisableTimestamp bool `toml:"disable_timestamp"` Filename string `toml:"filename"` FullTimestamp bool `toml:"full_timestamp"` Format string `toml:"format"` MessageKey string `toml:"message_key"` Out string `toml:"out"` TimestampFormat string `toml:"timestamp_format"` Verbose bool `toml:"verbose"` }
Configuration represents the configuration of the logger
func FlagConfig ¶
func FlagConfig() Configuration
FlagConfig generates a Configuration based on flags
type Logger ¶
type Logger interface { Debug(v ...interface{}) DebugC(ctx context.Context, v ...interface{}) DebugCf(ctx context.Context, format string, v ...interface{}) Debugf(format string, v ...interface{}) Info(v ...interface{}) InfoC(ctx context.Context, v ...interface{}) InfoCf(ctx context.Context, format string, v ...interface{}) Infof(format string, v ...interface{}) Warn(v ...interface{}) WarnC(ctx context.Context, v ...interface{}) WarnCf(ctx context.Context, format string, v ...interface{}) Warnf(format string, v ...interface{}) Error(v ...interface{}) ErrorC(ctx context.Context, v ...interface{}) ErrorCf(ctx context.Context, format string, v ...interface{}) Errorf(format string, v ...interface{}) Fatal(v ...interface{}) FatalC(ctx context.Context, v ...interface{}) FatalCf(ctx context.Context, format string, v ...interface{}) Fatalf(format string, v ...interface{}) WithField(k string, v interface{}) WithFields(fs Fields) }
Logger represents a logger
type LoggerSetter ¶
type LoggerSetter interface {
SetLogger(l Logger)
}
LoggerSetter represents a logger setter
type Logrus ¶
type Logrus struct {
// contains filtered or unexported fields
}
Logrus represents a logrus logger
func (*Logrus) WithFields ¶
type Writer ¶
type Writer struct {
// contains filtered or unexported fields
}
Writer represents an object capable of writing to the logger
type WriterFunc ¶
type WriterFunc func(text string)
WriterFunc represents a writer func
func LoggerFuncToWriterFunc ¶
func LoggerFuncToWriterFunc(fn func(args ...interface{})) WriterFunc
LoggerFuncToWriterFunc converts a logger func to a writer func
Click to show internal directories.
Click to hide internal directories.