Documentation ¶
Overview ¶
Simple logger similar to Go's standard logger with log level.
l := log.New(os.Stderr, INFO, "myapp") l.Error("something exploded")
Default logger:
log.Info("something %s", "here")
Index ¶
- Variables
- func Alert(msg string, args ...interface{}) error
- func Check(err error)
- func Critical(msg string, args ...interface{}) error
- func Debug(msg string, args ...interface{}) error
- func Emergency(msg string, args ...interface{}) error
- func Error(msg string, args ...interface{}) error
- func Info(msg string, args ...interface{}) error
- func Notice(msg string, args ...interface{}) error
- func SetLevel(level Level)
- func SetLevelString(level string)
- func SetPrefix(str string)
- func Warning(msg string, args ...interface{}) error
- type Level
- type Logger
- func (l *Logger) Alert(msg string, args ...interface{}) error
- func (l *Logger) Check(err error)
- func (l *Logger) Critical(msg string, args ...interface{}) error
- func (l *Logger) Debug(msg string, args ...interface{}) error
- func (l *Logger) Emergency(msg string, args ...interface{}) error
- func (l *Logger) Error(msg string, args ...interface{}) error
- func (l *Logger) Info(msg string, args ...interface{}) error
- func (l *Logger) Log(lvl string, level Level, msg string, args ...interface{}) error
- func (l *Logger) New(prefix string) *Logger
- func (l *Logger) Notice(msg string, args ...interface{}) error
- func (l *Logger) SetLevel(level Level)
- func (l *Logger) SetLevelFromEnv(name string)
- func (l *Logger) SetLevelString(level string) error
- func (l *Logger) SetPrefix(str string)
- func (l *Logger) Warning(msg string, args ...interface{}) error
- func (l *Logger) Write(b []byte) (n int, err error)
Constants ¶
This section is empty.
Variables ¶
View Source
var Log = New(os.Stderr, INFO, "")
Functions ¶
Types ¶
type Logger ¶
Logger.
func New ¶
New logger which writes to `w` at the given `level`. Optionally provide a `prefix` for the logger.
func (*Logger) SetLevelFromEnv ¶
SetLevelFromEnv forces the log level based on the given environment variable `name` when present.
func (*Logger) SetLevelString ¶
SetLevelString changes the log `level` via string. This is especially useful for providing a command-line flag to your program to adjust the level.
If the level string is invalid an error is returned.
Click to show internal directories.
Click to hide internal directories.