Documentation
¶
Index ¶
- Constants
- func ClearDebugToggleSignal()
- func Debug(format string, args ...interface{})
- func DebugBlock(prefix string, format string, args ...interface{})
- func DebugEnabled(source string) bool
- func DisableDebug(source string) bool
- func DisableLogging(source string) bool
- func EnableDebug(source string) bool
- func EnableLogging(source string) bool
- func Error(format string, args ...interface{})
- func ErrorBlock(prefix string, format string, args ...interface{})
- func Every(interval time.Duration) goxrate.Limit
- func Fatal(format string, args ...interface{})
- func Flush()
- func Info(format string, args ...interface{})
- func InfoBlock(prefix string, format string, args ...interface{})
- func LoggingEnabled(source string) bool
- func Panic(format string, args ...interface{})
- func RegisterBackend(name string, fn BackendFn)
- func SetBackend(name string) error
- func SetLevel(level Level)
- func SetupDebugToggleSignal(sig os.Signal)
- func Sync()
- func Warn(format string, args ...interface{})
- func WarnBlock(prefix string, format string, args ...interface{})
- type Backend
- type BackendFn
- type Delayed
- type Level
- type Logger
- type Rate
Constants ¶
const ( // DefaultWindow is the default message window size for rate limiting. DefaultWindow = 256 // MinimumWindow is the smallest message window size for rate limiting. MinimumWindow = 32 )
const ( // DefaultLevel is the default logging severity level. DefaultLevel = LevelInfo )
const (
// FmtBackendName is the name of our simple fmt-based logging backend.
FmtBackendName = "fmt"
)
Variables ¶
This section is empty.
Functions ¶
func ClearDebugToggleSignal ¶
func ClearDebugToggleSignal()
ClearDebugToggleSignal removes any signal handlers for toggling debug on/off.
func Debug ¶
func Debug(format string, args ...interface{})
Debug formats and emits a debug message.
func DebugBlock ¶
DebugBlock formats and emits a multiline debug message.
func DebugEnabled ¶
DebugEnabled checks if debug logging is enabled for the source.
func DisableDebug ¶
DisableDebug disables debug logging for the given source.
func DisableLogging ¶
DisableLogging disables non-debug logging for the given source.
func EnableDebug ¶
EnableDebug enables debug logging for the source.
func EnableLogging ¶
EnableLogging enables non-debug logging for the source.
func Error ¶
func Error(format string, args ...interface{})
Error formats and emits an error message.
func ErrorBlock ¶
ErrorBlock formats and emits a multiline error message.
func Fatal ¶
func Fatal(format string, args ...interface{})
Fatal formats and emits an error message and os.Exit()'s with status 1.
func Info ¶
func Info(format string, args ...interface{})
Info formats and emits an informational message.
func LoggingEnabled ¶
LoggingEnabled checks if non-debug logging is enabled for the source.
func Panic ¶
func Panic(format string, args ...interface{})
Panic formats and emits an error messages, and panics with the same.
func RegisterBackend ¶
RegisterBackend registers a logger backend.
func SetBackend ¶
SetBackend activates the named Backend for logging.
func SetupDebugToggleSignal ¶
SetupDebugToggleSignal sets up a signal handler to toggle full debugging on/off.
Types ¶
type Backend ¶
type Backend interface {
// Name returns the name of this backend.
Name() string
// Log emits log messages with the given severity, source, and Printf-like arguments.
Log(Level, string, string, ...interface{})
// Block emits a multi-line log messages, with an additional line prefix.
Block(Level, string, string, string, ...interface{})
// Flush flushes and stops initial buffering synchronously
Flush()
// Sync waits for all messages to get emitted.
Sync()
// Stop stops the backend instance.
Stop()
// SetSourceAlignment sets the maximum prefix length for optional alignment.
SetSourceAlignment(int)
}
Backend can format and emit log messages.
type BackendFn ¶
type BackendFn func() Backend
BackendFn is a functions that creates a Backend instance.
type Delayed ¶
type Delayed interface {
String() string
}
Delayed implements delayed evaluation (can lower the overhead of suppressed log.Debug).
type Level ¶
type Level int
Level describes the severity of log messages.
const ( // LevelDebug is the severity for debug messages. LevelDebug Level = iota // LevelInfo is the severity for informational messages. LevelInfo // LevelWarn is the severity for warnings. LevelWarn // LevelError is the severity for errors. LevelError // LevelPanic is the severity for panic messages. LevelPanic // LevelFatal is the severity for fatal errors. LevelFatal )
type Logger ¶
type Logger interface {
// Debug formats and emits a debug message.
Debug(format string, args ...interface{})
// Info formats and emits an informational message.
Info(format string, args ...interface{})
// Warn formats and emits a warning message.
Warn(format string, args ...interface{})
// Error formats and emits an error message.
Error(format string, args ...interface{})
// Panic formats and emits an error message then panics with the same.
Panic(format string, args ...interface{})
// Fatal formats and emits an error message and os.Exit()'s with status 1.
Fatal(format string, args ...interface{})
// DebugBlock formats and emits a multiline debug message.
DebugBlock(prefix string, format string, args ...interface{})
// InfoBlock formats and emits a multiline information message.
InfoBlock(prefix string, format string, args ...interface{})
// WarnBlock formats and emits a multiline warning message.
WarnBlock(prefix string, format string, args ...interface{})
// ErrorBlock formats and emits a multiline error message.
ErrorBlock(prefix string, format string, args ...interface{})
// EnableDebug enables debug messages for this Logger.
EnableDebug(bool) bool
// DebugEnabled checks if debug messages are enabled for this Logger.
DebugEnabled() bool
// Source returns the source name of this Logger.
Source() string
}
Logger is the interface for producing log messages for/from a particular source.