Documentation ¶
Index ¶
- Constants
- Variables
- func Block(fn func(string, ...interface{}), prefix string, format string, ...)
- func Debug(format string, args ...interface{})
- func DebugBlock(prefix string, format string, args ...interface{})
- func DebugEnabled() bool
- func EnableDebug(enable bool) bool
- func Error(format string, args ...interface{})
- func ErrorBlock(prefix string, format string, args ...interface{})
- func Fatal(format string, args ...interface{})
- func Info(format string, args ...interface{})
- func InfoBlock(prefix string, format string, args ...interface{})
- func Panic(format string, args ...interface{})
- func RegisterBackend(b Backend)
- func Warn(format string, args ...interface{})
- func WarnBlock(prefix string, format string, args ...interface{})
- type Backend
- type Level
- type Logger
Constants ¶
const ( // DefaultLevel is the default lowest unsuppressed severity. DefaultLevel = LevelInfo )
Variables ¶
var LevelNames = map[Level]string{
LevelDebug: "debug",
LevelInfo: "info",
LevelWarn: "warn",
LevelError: "error",
}
LevelNames maps severity levels to names.
var NamedLevels = map[string]Level{ "debug": LevelDebug, "info": LevelInfo, "warn": LevelWarn, "warning": LevelWarn, "error": LevelError, }
NamedLevels maps severity names to levels.
Functions ¶
func Debug ¶
func Debug(format string, args ...interface{})
Debug emit a debug message with the default source.
func DebugBlock ¶
DebugBlock emits a block of debug messages with the default source.
func DebugEnabled ¶
func DebugEnabled() bool
DebugEnabled returns the debugging state of the default source.
func EnableDebug ¶
EnableDebug controls debugging for the default source.
func Error ¶
func Error(format string, args ...interface{})
Error emit an error message with the default source.
func ErrorBlock ¶
ErrorBlock emits a block of error messages with the default source.
func Fatal ¶
func Fatal(format string, args ...interface{})
Fatal emit a fatal error message with the default source.
func Info ¶
func Info(format string, args ...interface{})
Info emit an info message with the default soruce.
func Panic ¶
func Panic(format string, args ...interface{})
Panic emit a fatal error message with the default source and panic.
Types ¶
type Backend ¶
type Backend interface { Name() string PrefixPreference() bool Enabled(Level) bool Info(message string) Warn(message string) Error(message string) Debug(message string) }
Backend is an entity that can emit log messages.
type Level ¶
type Level int32
Level is the log message severity level below which we suppress messages.
type Logger ¶
type Logger interface { Info(format string, args ...interface{}) Warn(format string, args ...interface{}) Error(format string, args ...interface{}) Fatal(format string, args ...interface{}) Panic(format string, args ...interface{}) EnableDebug(bool) bool DebugEnabled() bool Debug(format string, args ...interface{}) Block(fn func(string, ...interface{}), prefix string, format string, args ...interface{}) DebugBlock(prefix string, format string, args ...interface{}) InfoBlock(prefix string, format string, args ...interface{}) WarnBlock(prefix string, format string, args ...interface{}) ErrorBlock(prefix string, format string, args ...interface{}) Stop() }
Logger is the interface for configuring and producing log messages.