Documentation
¶
Index ¶
- Constants
- type ColouredFormatter
- type DefaultFormatter
- type Formatter
- type Logger
- type LoggerInterface
- type Wrapper
- func (w *Wrapper) Fatal(v ...interface{})
- func (w *Wrapper) Fatalf(format string, v ...interface{})
- func (w *Wrapper) Fatalln(v ...interface{})
- func (w *Wrapper) Panic(v ...interface{})
- func (w *Wrapper) Panicf(format string, v ...interface{})
- func (w *Wrapper) Panicln(v ...interface{})
- func (w *Wrapper) Print(v ...interface{})
- func (w *Wrapper) Printf(format string, v ...interface{})
- func (w *Wrapper) Println(v ...interface{})
Constants ¶
View Source
const ( // DEBUG level DEBUG level = iota // INFO level INFO // WARNING level WARNING // ERROR level ERROR // FATAL level FATAL )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ColouredFormatter ¶
type ColouredFormatter struct {
}
ColouredFormatter colours log messages with ASCI escape codes and adds filename and line number before the log message See https://en.wikipedia.org/wiki/ANSI_escape_code
func (*ColouredFormatter) Format ¶
func (f *ColouredFormatter) Format(lvl level, v ...interface{}) []interface{}
Format adds filename and line number before the log message
func (*ColouredFormatter) GetPrefix ¶
func (f *ColouredFormatter) GetPrefix(lvl level) string
GetPrefix returns colour escape code
func (*ColouredFormatter) GetSuffix ¶
func (f *ColouredFormatter) GetSuffix(lvl level) string
GetSuffix returns reset sequence code
type DefaultFormatter ¶
type DefaultFormatter struct {
}
DefaultFormatter adds filename and line number before the log message
func (*DefaultFormatter) Format ¶
func (f *DefaultFormatter) Format(lvl level, v ...interface{}) []interface{}
Format adds filename and line number before the log message
func (*DefaultFormatter) GetPrefix ¶
func (f *DefaultFormatter) GetPrefix(lvl level) string
GetPrefix returns ""
func (*DefaultFormatter) GetSuffix ¶
func (f *DefaultFormatter) GetSuffix(lvl level) string
GetSuffix returns ""
type Formatter ¶
type Formatter interface {
GetPrefix(lvl level) string
Format(lvl level, v ...interface{}) []interface{}
GetSuffix(lvl level) string
}
Formatter interface
type LoggerInterface ¶
type LoggerInterface interface {
Print(...interface{})
Printf(string, ...interface{})
Println(...interface{})
Fatal(...interface{})
Fatalf(string, ...interface{})
Fatalln(...interface{})
Panic(...interface{})
Panicf(string, ...interface{})
Panicln(...interface{})
}
LoggerInterface will accept stdlib logger and a custom logger. There's no standard interface, this is the closest we get, unfortunately.
Click to show internal directories.
Click to hide internal directories.