Documentation ¶
Index ¶
- func Debug(args ...interface{})
- func Debugf(template string, args ...interface{})
- func Error(args ...interface{})
- func Errorf(template string, args ...interface{})
- func Fatal(args ...interface{})
- func Fatalf(template string, args ...interface{})
- func Info(args ...interface{})
- func Infof(template string, args ...interface{})
- func Panic(args ...interface{})
- func Panicf(template string, args ...interface{})
- func Warn(args ...interface{})
- func Warnf(template string, args ...interface{})
- type Flags
- type Level
- type Logger
- func (l Logger) Debug(args ...interface{})
- func (l Logger) Debugf(template string, args ...interface{})
- func (l Logger) Error(args ...interface{})
- func (l Logger) Errorf(template string, args ...interface{})
- func (l Logger) Fatal(args ...interface{})
- func (l Logger) Fatalf(template string, args ...interface{})
- func (l Logger) Info(args ...interface{})
- func (l Logger) Infof(template string, args ...interface{})
- func (l Logger) Panic(args ...interface{})
- func (l Logger) Panicf(template string, args ...interface{})
- func (l Logger) Warn(args ...interface{})
- func (l Logger) Warnf(template string, args ...interface{})
- func (l *Logger) WithFlags(flags Flags) *Logger
- func (l *Logger) WithLevel(lvl Level) *Logger
- func (l *Logger) WithOutput(w io.Writer) *Logger
- func (l *Logger) WithPrefix(prefix string) *Logger
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Debug ¶
func Debug(args ...interface{})
Debug uses fmt.Sprint to construct and log a message at DebugLevel.
func Debugf ¶
func Debugf(template string, args ...interface{})
Debugf uses fmt.Sprintf to log a formatted message at DebugLevel.
func Error ¶
func Error(args ...interface{})
Error uses fmt.Sprint to construct and log a message at ErrorLevel.
func Errorf ¶
func Errorf(template string, args ...interface{})
Errorf uses fmt.Sprintf log a formatted message at ErrorLevel.
func Fatal ¶
func Fatal(args ...interface{})
Fatal uses fmt.Sprint to construct and log a message at FatalLevel, then calls os.Exit.
func Fatalf ¶
func Fatalf(template string, args ...interface{})
Fatalf uses fmt.Sprintf log a formatted message at FatalLevel, then calls os.Exit.
func Info ¶
func Info(args ...interface{})
Info uses fmt.Sprint to construct and log a message at InfoLevel.
func Infof ¶
func Infof(template string, args ...interface{})
Infof uses fmt.Sprintf log a formatted message at InfoLevel.
func Panic ¶
func Panic(args ...interface{})
Panic uses fmt.Sprint to construct and log a message at PanicLevel, then panics.
func Panicf ¶
func Panicf(template string, args ...interface{})
Panicf uses fmt.Sprintf log a formatted message at PanicLevel, then panics.
Types ¶
type Flags ¶
type Flags int8
Type Flags represents logger flags (a wrapper around log.L* flags).
var ( // More verbose logging flags for debugging/development. FlagsDevelopment Flags = log.LstdFlags | log.Lmicroseconds | log.Lmsgprefix // Less verbose logging info. FlagsProduction Flags = log.LstdFlags | log.Lmsgprefix )
type Level ¶
type Level int8
A Level is a logging priority. Higher levels are more important.
const ( // DebugLevel logs are typically voluminous, and are usually disabled in // production. DebugLevel Level = iota - 1 // InfoLevel is the default logging priority. InfoLevel // WarnLevel logs are more important than Info, but don't need individual // human review. WarnLevel // ErrorLevel logs are high-priority. If an application is running smoothly, // it shouldn't generate any error-level logs. ErrorLevel // PanicLevel logs a message, then panics. PanicLevel // FatalLevel logs a message, then calls os.Exit(1). FatalLevel )
type Logger ¶
type Logger struct {
// contains filtered or unexported fields
}
Type Logger represents a logger instance with a specific unit name (prefix) and logging level. New instances are to be created with logging.New().
func New ¶
func New() *Logger
Creates a new Logger with the given options. The default logger has FlagsProduction, logs at InfoLevel, has no prefix and outputs to os.Stderr.
func (Logger) Debug ¶
func (l Logger) Debug(args ...interface{})
Debug uses fmt.Sprint to construct and log a message at DebugLevel.
func (Logger) Error ¶
func (l Logger) Error(args ...interface{})
Error uses fmt.Sprint to construct and log a message at ErrorLevel.
func (Logger) Fatal ¶
func (l Logger) Fatal(args ...interface{})
Fatal uses fmt.Sprint to construct and log a message at FatalLevel, then calls os.Exit.
func (Logger) Fatalf ¶
Fatalf uses fmt.Sprintf log a formatted message at FatalLevel, then calls os.Exit.
func (Logger) Info ¶
func (l Logger) Info(args ...interface{})
Info uses fmt.Sprint to construct and log a message at InfoLevel.
func (Logger) Panic ¶
func (l Logger) Panic(args ...interface{})
Panic uses fmt.Sprint to construct and log a message at PanicLevel, then panics.
func (Logger) Warn ¶
func (l Logger) Warn(args ...interface{})
Warn uses fmt.Sprint to construct and log a message at WarnLevel.
func (*Logger) WithFlags ¶
Changes the flags for the inderlying log.Logger. Default is FlagsProduction.
func (*Logger) WithLevel ¶
Sets a minimum logging level for the logger being created. Default is InfoLevel.
func (*Logger) WithOutput ¶
Sets the output sink for the underlying log.Logger.
func (*Logger) WithPrefix ¶
Gives a specific name to the logger. Will be included in the output as '[prefix]'. Default is empty string (no prefix will be printed).