Documentation ¶
Index ¶
- Constants
- func Debug(args ...interface{})
- func Debugf(format string, args ...interface{})
- func Error(args ...interface{})
- func Errorf(format string, args ...interface{})
- func Fatal(args ...interface{})
- func Fatalf(format string, args ...interface{})
- func Flush()
- func GetLogLevel() string
- func Info(args ...interface{})
- func Infof(format string, args ...interface{})
- func LevelHandler(w http.ResponseWriter, r *http.Request)
- func Panic(args ...interface{})
- func Panicf(format string, args ...interface{})
- func Print(args ...interface{})
- func Printf(format string, args ...interface{})
- func Println(args ...interface{})
- func SetLogLevel(level string)
- func Warn(args ...interface{})
- func Warnf(format string, args ...interface{})
- type Level
- type Logger
Constants ¶
View Source
const ( // DebugLevel logs a lot, and should be disabled in production. DebugLevel = "debug" // InfoLevel is the default logging priority. InfoLevel = "info" // WarnLevel logs are more important than Info, but don't need user attention right away. WarnLevel = "warn" // ErrorLevel logs are high-priority. ErrorLevel = "error" // FatalLevel logs a message, then calls os.Exit(1). FatalLevel = "fatal" // PanicLevel logs a message, then panics. PanicLevel = "panic" )
Variables ¶
This section is empty.
Functions ¶
func Debugf ¶
func Debugf(format string, args ...interface{})
Debugf formats the log message according to a format.
func Errorf ¶
func Errorf(format string, args ...interface{})
Errorf formats the log message according to a format.
func Fatalf ¶
func Fatalf(format string, args ...interface{})
Fatalf formats the log message according to a format, then calls os.Exit.
func GetLogLevel ¶
func GetLogLevel() string
func Infof ¶
func Infof(format string, args ...interface{})
Infof formats the log message according to a format.
func LevelHandler ¶
func LevelHandler(w http.ResponseWriter, r *http.Request)
LevelHandler is a simple JSON endpoint that can report on or change the current logging level.
GET requests return a JSON description of the current logging level. PUT requests change the logging level and expect a payload like: {"level":"info"}
func Panicf ¶
func Panicf(format string, args ...interface{})
Panicf formats the log message according to a format, then panics.
Types ¶
type Logger ¶
type Logger interface { GetLogLevel() string SetLogLevel(level string) Debug(args ...interface{}) Debugf(format string, args ...interface{}) Info(args ...interface{}) Infof(format string, args ...interface{}) Warn(args ...interface{}) Warnf(format string, args ...interface{}) Error(args ...interface{}) Errorf(format string, args ...interface{}) Fatal(args ...interface{}) Fatalf(format string, args ...interface{}) Panic(args ...interface{}) Panicf(format string, args ...interface{}) Print(args ...interface{}) Printf(format string, args ...interface{}) Println(args ...interface{}) // for prometheus Flush() Named(name string) Logger With(args ...interface{}) Logger LevelHandler(w http.ResponseWriter, r *http.Request) }
var DefaultLogger Logger = NewZapLogger()
func NewNoopLogger ¶
func NewNoopLogger() Logger
func NewZapLogger ¶
func NewZapLogger() Logger
Click to show internal directories.
Click to hide internal directories.