Documentation
¶
Overview ¶
Package log implements multilevel logging.
Index ¶
- func All(v ...interface{})
- func Allf(format string, v ...interface{})
- func Allln(v ...interface{})
- func Assert(b bool)
- func Assertf(b bool, format string, v ...interface{})
- func Debug(v ...interface{})
- func Debugf(format string, v ...interface{})
- func Debugln(v ...interface{})
- func Error(v ...interface{})
- func Errorf(format string, v ...interface{})
- func Errorln(v ...interface{})
- func Fatal(v ...interface{})
- func Fatalf(format string, v ...interface{})
- func Fatalln(v ...interface{})
- func Flush()
- func GetPrefix() (prefix string)
- func Info(v ...interface{})
- func Infof(format string, v ...interface{})
- func Infoln(v ...interface{})
- func Notice(v ...interface{})
- func Noticef(format string, v ...interface{})
- func Noticeln(v ...interface{})
- func Panic(v ...interface{})
- func Panicf(format string, v ...interface{})
- func Panicln(v ...interface{})
- func SetBufferedOutput(bufferSize int)
- func SetHighlight(highlight bool)
- func SetLevel(level Level)
- func SetLine(line bool)
- func SetOut(w io.Writer)
- func SetPrefix(prefix string)
- func SetShortLevel(shortLevel bool)
- func Trace(v ...interface{})
- func Tracef(format string, v ...interface{})
- func Traceln(v ...interface{})
- func Warn(v ...interface{})
- func Warnf(format string, v ...interface{})
- func Warnln(v ...interface{})
- type Level
- type Logger
- func (l *Logger) All(v ...interface{})
- func (l *Logger) Allf(format string, v ...interface{})
- func (l *Logger) Allln(v ...interface{})
- func (l *Logger) Assert(b bool)
- func (l *Logger) Assertf(b bool, format string, v ...interface{})
- func (l *Logger) Debug(v ...interface{})
- func (l *Logger) Debugf(format string, v ...interface{})
- func (l *Logger) Debugln(v ...interface{})
- func (l *Logger) Error(v ...interface{})
- func (l *Logger) Errorf(format string, v ...interface{})
- func (l *Logger) Errorln(v ...interface{})
- func (l *Logger) Fatal(v ...interface{})
- func (l *Logger) Fatalf(format string, v ...interface{})
- func (l *Logger) Fatalln(v ...interface{})
- func (l *Logger) Flush()
- func (l *Logger) GetLevel() Level
- func (l *Logger) GetPrefix() (prefix string)
- func (l *Logger) Info(v ...interface{})
- func (l *Logger) Infof(format string, v ...interface{})
- func (l *Logger) Infoln(v ...interface{})
- func (l *Logger) Notice(v ...interface{})
- func (l *Logger) Noticef(format string, v ...interface{})
- func (l *Logger) Noticeln(v ...interface{})
- func (l *Logger) Panic(v ...interface{})
- func (l *Logger) Panicf(format string, v ...interface{})
- func (l *Logger) Panicln(v ...interface{})
- func (l *Logger) SetBufferedOutput(bufferSize int)
- func (l *Logger) SetHighlight(highlight bool)
- func (l *Logger) SetLevel(level Level)
- func (l *Logger) SetLine(line bool)
- func (l *Logger) SetOut(w io.Writer)
- func (l *Logger) SetPrefix(prefix string)
- func (l *Logger) SetShortLevel(shortLevel bool)
- func (l *Logger) Trace(v ...interface{})
- func (l *Logger) Tracef(format string, v ...interface{})
- func (l *Logger) Traceln(v ...interface{})
- func (l *Logger) Warn(v ...interface{})
- func (l *Logger) Warnf(format string, v ...interface{})
- func (l *Logger) Warnln(v ...interface{})
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Allf ¶
func Allf(format string, v ...interface{})
Allf is equivalent to log.Printf() for all log.
func Assert ¶ added in v1.0.2
func Assert(b bool)
Assert asserts that b is true. Otherwise, it would log fatal.
func Debugf ¶
func Debugf(format string, v ...interface{})
Debugf is equivalent to log.Printf() for debug.
func Errorf ¶
func Errorf(format string, v ...interface{})
Errorf is equivalent to log.Printf() for error.
func Fatalf ¶
func Fatalf(format string, v ...interface{})
Fatalf is equivalent to log.Printf() for fatal.
func Flush ¶ added in v1.0.5
func Flush()
Flush writes any buffered data to the underlying io.Writer.
func Infof ¶
func Infof(format string, v ...interface{})
Infof is equivalent to log.Printf() for info.
func Noticef ¶
func Noticef(format string, v ...interface{})
Noticef is equivalent to log.Printf() for notice.
func Panicf ¶
func Panicf(format string, v ...interface{})
Panicf is equivalent to log.Printf() for panic.
func SetBufferedOutput ¶ added in v1.0.5
func SetBufferedOutput(bufferSize int)
SetBufferedOutput sets the buffered writer with the buffer size.
func SetHighlight ¶ added in v1.0.2
func SetHighlight(highlight bool)
SetHighlight sets whether to enable the highlight field.
func SetLine ¶ added in v1.0.2
func SetLine(line bool)
SetLine sets whether to enable the line field .
func SetOut ¶
SetOut sets log's writer. The out variable sets the destination to which log data will be written.
func SetShortLevel ¶ added in v1.0.2
func SetShortLevel(shortLevel bool)
SetShortLevel sets whether to enable the short level name.
func Tracef ¶
func Tracef(format string, v ...interface{})
Tracef is equivalent to log.Printf() for trace.
Types ¶
type Level ¶
type Level uint8
Level defines the level for log. Higher levels log less info.
const ( //AllLevel defines the lowest level. AllLevel Level = 0 //TraceLevel defines the level of trace in test environments. TraceLevel Level = 1 //DebugLevel defines the level of debug. DebugLevel Level = 2 //InfoLevel defines the level of info. InfoLevel Level = 3 //NoticeLevel defines the level of notice. NoticeLevel Level = 4 //WarnLevel defines the level of warn. WarnLevel Level = 5 //ErrorLevel defines the level of error. ErrorLevel Level = 6 //PanicLevel defines the level of panic. PanicLevel Level = 7 //FatalLevel defines the level of fatal. FatalLevel Level = 8 //OffLevel defines the level of no log. OffLevel Level = 9 )
type Logger ¶
type Logger struct {
// contains filtered or unexported fields
}
Logger defines the logger.
func (*Logger) All ¶
func (l *Logger) All(v ...interface{})
All is equivalent to log.Print() for all log.
func (*Logger) Allln ¶
func (l *Logger) Allln(v ...interface{})
Allln is equivalent to log.Println() for all log.
func (*Logger) Assert ¶ added in v1.0.2
Assert asserts that b is true. Otherwise, it would log fatal.
func (*Logger) Debug ¶
func (l *Logger) Debug(v ...interface{})
Debug is equivalent to log.Print() for debug.
func (*Logger) Debugln ¶
func (l *Logger) Debugln(v ...interface{})
Debugln is equivalent to log.Println() for debug.
func (*Logger) Error ¶
func (l *Logger) Error(v ...interface{})
Error is equivalent to log.Print() for error.
func (*Logger) Errorln ¶
func (l *Logger) Errorln(v ...interface{})
Errorln is equivalent to log.Println() for error.
func (*Logger) Fatal ¶
func (l *Logger) Fatal(v ...interface{})
Fatal is equivalent to log.Print() for fatal.
func (*Logger) Fatalln ¶
func (l *Logger) Fatalln(v ...interface{})
Fatalln is equivalent to log.Println() for fatal.
func (*Logger) Flush ¶ added in v1.0.5
func (l *Logger) Flush()
Flush writes any buffered data to the underlying io.Writer.
func (*Logger) Info ¶
func (l *Logger) Info(v ...interface{})
Info is equivalent to log.Print() for info.
func (*Logger) Infoln ¶
func (l *Logger) Infoln(v ...interface{})
Infoln is equivalent to log.Println() for info.
func (*Logger) Notice ¶
func (l *Logger) Notice(v ...interface{})
Notice is equivalent to log.Print() for notice.
func (*Logger) Noticeln ¶
func (l *Logger) Noticeln(v ...interface{})
Noticeln is equivalent to log.Println() for notice.
func (*Logger) Panic ¶
func (l *Logger) Panic(v ...interface{})
Panic is equivalent to log.Print() for panic.
func (*Logger) Panicln ¶
func (l *Logger) Panicln(v ...interface{})
Panicln is equivalent to log.Println() for panic.
func (*Logger) SetBufferedOutput ¶ added in v1.0.5
SetBufferedOutput sets the buffered writer with the buffer size.
func (*Logger) SetHighlight ¶ added in v1.0.2
SetHighlight sets whether to enable the highlight field.
func (*Logger) SetOut ¶
SetOut sets log's writer. The out variable sets the destination to which log data will be written.
func (*Logger) SetShortLevel ¶ added in v1.0.2
SetShortLevel sets whether to enable the short level name.
func (*Logger) Trace ¶
func (l *Logger) Trace(v ...interface{})
Trace is equivalent to log.Print() for trace.
func (*Logger) Traceln ¶
func (l *Logger) Traceln(v ...interface{})
Traceln is equivalent to log.Println() for trace.
func (*Logger) Warn ¶
func (l *Logger) Warn(v ...interface{})
Warn is equivalent to log.Print() for warn.