Documentation ¶
Index ¶
- func Debug(v ...interface{})
- func Debugf(format string, v ...interface{})
- func Error(v ...interface{})
- func Errorf(format string, v ...interface{})
- func Fatal(v ...interface{})
- func Fatalf(format string, v ...interface{})
- func Info(v ...interface{})
- func Infof(format string, v ...interface{})
- func SetFormatter(fmtter Formatter)
- func SetLevel(lvl Level)
- func SetOutput(out io.Writer)
- func Warning(v ...interface{})
- func Warningf(format string, v ...interface{})
- type Formatter
- type Level
- type Logger
- func (l *Logger) Debug(v ...interface{})
- func (l *Logger) Debugf(format string, v ...interface{})
- func (l *Logger) Error(v ...interface{})
- func (l *Logger) Errorf(format string, v ...interface{})
- func (l *Logger) Fatal(v ...interface{})
- func (l *Logger) Fatalf(format string, v ...interface{})
- func (l *Logger) Info(v ...interface{})
- func (l *Logger) Infof(format string, v ...interface{})
- func (l *Logger) SetFormatter(fmtter Formatter)
- func (l *Logger) SetLevel(lvl Level)
- func (l *Logger) SetOutput(out io.Writer)
- func (l *Logger) Warning(v ...interface{})
- func (l *Logger) Warningf(format string, v ...interface{})
- type Record
- type TextFormatter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SetFormatter ¶
func SetFormatter(fmtter Formatter)
SetFormatter sets the formatter of default Logger
Types ¶
type Logger ¶
type Logger struct {
// contains filtered or unexported fields
}
Logger provides a struct with fields that describe the details of logger.
func DefaultLogger ¶
func DefaultLogger() *Logger
DefaultLogger returns the default logger within the pkg, i.e. the one used in log.Infof....
func (*Logger) SetFormatter ¶
SetFormatter sets the formatter of Logger l
type Record ¶
type Record struct { Time time.Time // time when the log produced Msg string // content of the log Line string // in which file and line that the log produced Lvl Level // level of the log }
Record holds information about log
type TextFormatter ¶
type TextFormatter struct {
// contains filtered or unexported fields
}
TextFormatter represents a kind of formatter that formats the logs as plain text
func NewTextFormatter ¶
func NewTextFormatter() *TextFormatter
NewTextFormatter returns a TextFormatter, the format of time is time.RFC3339
func (*TextFormatter) Format ¶
func (t *TextFormatter) Format(r *Record) (b []byte, err error)
Format formats the logs as "time [level] line message"
func (*TextFormatter) SetTimeFormat ¶
func (t *TextFormatter) SetTimeFormat(fmt string)
SetTimeFormat sets time format of TextFormatter if the parameter fmt is not null
Click to show internal directories.
Click to hide internal directories.