Documentation ¶
Index ¶
- Constants
- func SetLevel(level int)
- type Logger
- func (logger *Logger) Debug(data ...interface{})
- func (logger *Logger) Error(data ...interface{})
- func (logger *Logger) Fatal(data ...interface{})
- func (logger *Logger) Info(data ...interface{})
- func (logger *Logger) Panic(data ...interface{})
- func (logger *Logger) SubLogger(prefix string) (subLogger *Logger)
- func (logger *Logger) Warn(data ...interface{})
Constants ¶
const ( LevelDebug int = iota LevelInfo LevelWarn LevelError )
Logger levels
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Logger ¶
type Logger struct {
// contains filtered or unexported fields
}
Logger is a util class to print log in different level like DEBUG. It has 4 level: DEBUG, INFO, WARN, ERROR, and 2 exception logger: PANIC and FATAL
func (*Logger) Debug ¶
func (logger *Logger) Debug(data ...interface{})
Debug print log message as DEBUG level. if you set log level higher than LevelDebug, no message will be print.
func (*Logger) Error ¶
func (logger *Logger) Error(data ...interface{})
Error print log message as ERROR level. This function do not create panic or fatal, it just print error message. If you want get a runtime panic or fatal, use Logger.Panic or Logger.Fatal instead.
func (*Logger) Fatal ¶
func (logger *Logger) Fatal(data ...interface{})
Fatal print log message, and create a fatal use the message.
func (*Logger) Info ¶
func (logger *Logger) Info(data ...interface{})
Info print log message as INFO level. If you set log level higher than LevelInfo, no message will be print.
func (*Logger) Panic ¶
func (logger *Logger) Panic(data ...interface{})
Panic print log message, and create a panic use the message.