Documentation ¶
Index ¶
- func Debug(args ...interface{})
- func DebugCtx(ctx Context, m string)
- func Debugf(f string, args ...interface{})
- func DebugfCtx(ctx Context, f string, args ...interface{})
- func Debugln(args ...interface{})
- func Error(args ...interface{})
- func ErrorCtx(ctx Context, m string)
- func Errorf(f string, args ...interface{})
- func ErrorfCtx(ctx Context, f string, args ...interface{})
- func Errorln(args ...interface{})
- func Fatal(args ...interface{})
- func FatalCtx(ctx Context, m string)
- func Fatalf(f string, args ...interface{})
- func FatalfCtx(ctx Context, f string, args ...interface{})
- func Fatalln(args ...interface{})
- func Info(args ...interface{})
- func InfoCtx(ctx Context, m string)
- func Infof(f string, args ...interface{})
- func InfofCtx(ctx Context, f string, args ...interface{})
- func Infoln(args ...interface{})
- func LevelToString(level Level) string
- func Panic(args ...interface{})
- func PanicCtx(ctx Context, m string)
- func Panicf(f string, args ...interface{})
- func PanicfCtx(ctx Context, f string, args ...interface{})
- func Panicln(args ...interface{})
- func Print(args ...interface{})
- func Printf(f string, args ...interface{})
- func Println(args ...interface{})
- func SetFormatter(f Formatter)
- func SetLevel(lvl Level)
- func SetOutput(o io.Writer)
- func Warn(args ...interface{})
- func WarnCtx(ctx Context, m string)
- func Warnf(f string, args ...interface{})
- func WarnfCtx(ctx Context, f string, args ...interface{})
- func Warnln(args ...interface{})
- type BufferPool
- type ConcurrentWriter
- type Context
- type Formatter
- type ILogger
- type JSONFormatter
- type Level
- type Logger
- func (l *Logger) Debug(args ...interface{})
- func (l *Logger) DebugCtx(ctx Context, args ...interface{})
- func (l *Logger) Debugf(f string, args ...interface{})
- func (l *Logger) DebugfCtx(ctx Context, f string, args ...interface{})
- func (l *Logger) Debugln(args ...interface{})
- func (l *Logger) Error(args ...interface{})
- func (l *Logger) ErrorCtx(ctx Context, args ...interface{})
- func (l *Logger) Errorf(f string, args ...interface{})
- func (l *Logger) ErrorfCtx(ctx Context, f string, args ...interface{})
- func (l *Logger) Errorln(args ...interface{})
- func (l *Logger) Fatal(args ...interface{})
- func (l *Logger) FatalCtx(ctx Context, args ...interface{})
- func (l *Logger) Fatalf(f string, args ...interface{})
- func (l *Logger) FatalfCtx(ctx Context, f string, args ...interface{})
- func (l *Logger) Fatalln(args ...interface{})
- func (l *Logger) GetContext() Context
- func (l *Logger) GetLevel() Level
- func (l *Logger) GetTraceLevel() Level
- func (l *Logger) Info(args ...interface{})
- func (l *Logger) InfoCtx(ctx Context, args ...interface{})
- func (l *Logger) Infof(f string, args ...interface{})
- func (l *Logger) InfofCtx(ctx Context, f string, args ...interface{})
- func (l *Logger) Infoln(args ...interface{})
- func (l *Logger) Panic(args ...interface{})
- func (l *Logger) PanicCtx(ctx Context, args ...interface{})
- func (l *Logger) Panicf(f string, args ...interface{})
- func (l *Logger) PanicfCtx(ctx Context, f string, args ...interface{})
- func (l *Logger) Panicln(args ...interface{})
- func (l *Logger) Print(args ...interface{})
- func (l *Logger) Printf(f string, args ...interface{})
- func (l *Logger) Println(args ...interface{})
- func (l *Logger) SetFormatter(f Formatter)
- func (l *Logger) SetLevel(lvl Level)
- func (l *Logger) SetOutput(o io.Writer)
- func (l *Logger) SetTraceLevel(lvl Level)
- func (l *Logger) Warn(args ...interface{})
- func (l *Logger) WarnCtx(ctx Context, args ...interface{})
- func (l *Logger) Warnf(f string, args ...interface{})
- func (l *Logger) WarnfCtx(ctx Context, f string, args ...interface{})
- func (l *Logger) Warnln(args ...interface{})
- func (l *Logger) WithContext(ctx Context) ILogger
- type LogstashFormatter
- type Pool
- type StandardLogger
- type SyslogWriter
- type TextFormatter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Debugf ¶
func Debugf(f string, args ...interface{})
Debugf write debug log message, fmt.Sprtinf style
func Errorf ¶
func Errorf(f string, args ...interface{})
Errorf write error log message fmt.Printf style
func Fatalf ¶
func Fatalf(f string, args ...interface{})
Fatalf write fatal log message and call os.Exit, fmt.Sprtinf style
func Fatalln ¶
func Fatalln(args ...interface{})
Fatalln not supported, only for standart logger interface compatibility call os.Exit anyway
func Infof ¶
func Infof(f string, args ...interface{})
Infof write info log message, fmt.Sprtinf style
func LevelToString ¶
LevelToString convert LogLevel to a string
func Panicf ¶
func Panicf(f string, args ...interface{})
Panicf write panice log message and throw panic, fmt.Sprintf style
func Panicln ¶
func Panicln(args ...interface{})
Panicln not supported, only for standart logger interface compatibility throw panic anyway
func Println ¶
func Println(args ...interface{})
Println not supported, only for standart logger interface compatibility
func Warnf ¶
func Warnf(f string, args ...interface{})
Warnf write warning log message, fmt.Sprintf style
Types ¶
type BufferPool ¶
BufferPool is pool of buffers
type ConcurrentWriter ¶
type ConcurrentWriter struct {
// contains filtered or unexported fields
}
ConcurrentWriter write log message to output with output lock
func NewConcurrentWriter ¶
func NewConcurrentWriter(w io.Writer) *ConcurrentWriter
NewConcurrentWriter yield new concurrent writer instance
type Formatter ¶
type Formatter interface {
Format(out *bytes.Buffer, lvl Level, ctx Context, msg string, trace []byte) *bytes.Buffer
}
Formatter format log message to needed output
type ILogger ¶
type ILogger interface { WithContext(Context) ILogger GetContext() Context SetFormatter(Formatter) SetOutput(io.Writer) SetLevel(Level) SetTraceLevel(Level) Print(...interface{}) Debug(...interface{}) Info(...interface{}) Warn(...interface{}) Error(...interface{}) Fatal(...interface{}) Panic(...interface{}) Printf(string, ...interface{}) Debugf(string, ...interface{}) Infof(string, ...interface{}) Warnf(string, ...interface{}) Errorf(string, ...interface{}) Fatalf(string, ...interface{}) Panicf(string, ...interface{}) Println(...interface{}) Debugln(...interface{}) Infoln(...interface{}) Warnln(...interface{}) Errorln(...interface{}) Fatalln(...interface{}) Panicln(...interface{}) DebugCtx(Context, ...interface{}) InfoCtx(Context, ...interface{}) WarnCtx(Context, ...interface{}) ErrorCtx(Context, ...interface{}) FatalCtx(Context, ...interface{}) PanicCtx(Context, ...interface{}) DebugfCtx(Context, string, ...interface{}) InfofCtx(Context, string, ...interface{}) WarnfCtx(Context, string, ...interface{}) ErrorfCtx(Context, string, ...interface{}) FatalfCtx(Context, string, ...interface{}) PanicfCtx(Context, string, ...interface{}) }
ILogger interface
func WithContext ¶
WithContext yield new logger instance with context new context append to current context
type Logger ¶
type Logger struct { Level Level TraceLevel Level Writer io.Writer Formatter Formatter Pool *BufferPool Context Context // contains filtered or unexported fields }
Logger struct
func (*Logger) Errorln ¶
func (l *Logger) Errorln(args ...interface{})
Errorln write error log message
func (*Logger) Fatalln ¶
func (l *Logger) Fatalln(args ...interface{})
Fatalln not supported, only for standart logger interface compatibility
func (*Logger) GetContext ¶
GetContext return current global log context
func (*Logger) GetTraceLevel ¶
GetTraceLevel return max trace level
func (*Logger) Panic ¶
func (l *Logger) Panic(args ...interface{})
Panic write panice log message and throw panic
func (*Logger) PanicfCtx ¶
PanicfCtx write panice log message with context and throw panic, fmt.Sprintf style
func (*Logger) Panicln ¶
func (l *Logger) Panicln(args ...interface{})
Panicln not supported, only for standart logger interface compatibility throw panic anyway
func (*Logger) Println ¶
func (l *Logger) Println(args ...interface{})
Println not supported, only for standart logger interface compatibility
func (*Logger) SetFormatter ¶
SetFormatter set log message formatter
func (*Logger) SetTraceLevel ¶
SetTraceLevel set max log level for adding trace
func (*Logger) Warnln ¶
func (l *Logger) Warnln(args ...interface{})
Warnln write warning log message
func (*Logger) WithContext ¶
WithContext yield new logger instance with context new context append to current context
type LogstashFormatter ¶
type LogstashFormatter struct{}
LogstashFormatter is log message formatter to logstash format
type StandardLogger ¶
type StandardLogger interface { Print(...interface{}) Printf(string, ...interface{}) Println(...interface{}) Fatal(...interface{}) Fatalf(string, ...interface{}) Fatalln(...interface{}) Panic(...interface{}) Panicf(string, ...interface{}) Panicln(...interface{}) }
StandardLogger is log package interface
type SyslogWriter ¶
type SyslogWriter struct { Writer io.WriteCloser // contains filtered or unexported fields }
SyslogWriter write logs to syslog
func NewSyslogWriter ¶
func NewSyslogWriter(network, addr, tag string, timeout time.Duration) *SyslogWriter
NewSyslogWriter return new SyslogWriter instance with concurrent writer to syslog