Documentation
¶
Index ¶
- Constants
- type Level
- type Logger
- func (l *Logger) Critical(v ...interface{})
- func (l *Logger) Criticalf(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) Level() Level
- func (l *Logger) Output(level Level, s string) error
- func (l *Logger) Panic(v ...interface{})
- func (l *Logger) Panicf(format string, v ...interface{})
- func (l *Logger) Print(v ...interface{})
- func (l *Logger) Printf(format string, v ...interface{})
- func (l *Logger) SetLevel(level Level) error
- func (l *Logger) SetOutput(w io.Writer)
- func (l *Logger) Warn(v ...interface{})
- func (l *Logger) Warnf(format string, v ...interface{})
Constants ¶
const DefaultLevel = Info
DefaultLevel represents the default log level.
const EnvLevel = "LOG_LEVEL"
EnvLevel holds the name of environment variable for the log level. It's here for the convenience.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Level ¶
type Level uint32
Level defines the log Level.
func ParseLevel ¶
ParseLevel parses the level string. If the name of level is unknown it returns an error and the default level.
type Logger ¶
type Logger struct {
// contains filtered or unexported fields
}
Logger defines the properties of the logger.
func New ¶
func New() *Logger
New creates a new Logger with the output assigned to stderr and the default log level.
func (*Logger) Critical ¶
func (l *Logger) Critical(v ...interface{})
Critical prints to the logger at "Critical" log level.
func (*Logger) Error ¶
func (l *Logger) Error(v ...interface{})
Error prints to the logger at "Error" log level.
func (*Logger) Fatal ¶
func (l *Logger) Fatal(v ...interface{})
Fatal prints to the logger at "Critical" log level and finishes the app.
func (*Logger) Fatalf ¶
Fatalf prints formatted output to the logger at "Critical" log level and finishes the app.
func (*Logger) Info ¶
func (l *Logger) Info(v ...interface{})
Info prints to the logger at "Info" log level.
func (*Logger) Panic ¶
func (l *Logger) Panic(v ...interface{})
Panic prints to the logger at "Critical" log level and panics.
func (*Logger) Panicf ¶
Panicf prints formatted output to the logger at "Critical" log level and panics.
func (*Logger) Print ¶
func (l *Logger) Print(v ...interface{})
Print prints to the logger at "Info" log level. It is added for backward compatibility with the standard logger.
func (*Logger) Printf ¶
Printf prints formatted output to the logger at "Info" log level. It is added for backward compatibility with the standard logger.