Documentation ¶
Overview ¶
The Tideland Go Library logger package provides a flexible way to log information with different levels and on different backends.
Index ¶
- func Criticalf(format string, args ...interface{})
- func Debugf(format string, args ...interface{})
- func Errorf(format string, args ...interface{})
- func Fatalf(format string, args ...interface{})
- func Infof(format string, args ...interface{})
- func OsFatalExiter()
- func PackageVersion() version.Version
- func PanicFatalExiter()
- func SetLogger(l Logger)
- func Warningf(format string, args ...interface{})
- type FatalExiterFunc
- type GoLogger
- type LogLevel
- type Logger
- type StandardLogger
- func (sl *StandardLogger) Critical(info, msg string)
- func (sl *StandardLogger) Debug(info, msg string)
- func (sl *StandardLogger) Error(info, msg string)
- func (sl *StandardLogger) Fatal(info, msg string)
- func (sl *StandardLogger) Info(info, msg string)
- func (sl *StandardLogger) Warning(info, msg string)
- type SysLogger
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Criticalf ¶
func Criticalf(format string, args ...interface{})
Criticalf logs a message at critical level.
func Fatalf ¶
func Fatalf(format string, args ...interface{})
Fatalf logs a message independant of any level. After logging the message the functions calls the fatal exiter function, which by default means exiting the application with error code -1.
func OsFatalExiter ¶
func OsFatalExiter()
OsFatalExiter exits the application with os.Exit and the return code -1.
func PackageVersion ¶
PackageVersion returns the version of the version package.
func PanicFatalExiter ¶
func PanicFatalExiter()
PanacFatalExiter exits the application with a panic.
Types ¶
type FatalExiterFunc ¶
type FatalExiterFunc func()
FatalExiterFunc defines a functions that will be called in case of a Fatalf call.
func SetFatalExiter ¶
func SetFatalExiter(fef FatalExiterFunc) FatalExiterFunc
SetFatalExiter sets the fatal exiter function and returns the current one.
type GoLogger ¶
type GoLogger struct{}
GoLogger just uses the standard go log package.
type LogLevel ¶
type LogLevel int
LogLevel describes the chosen log level between debug and critical.
Log levels to control the logging output.
type Logger ¶
type Logger interface { // Debug logs a debugging message. Debug(info, msg string) // Info logs an informational message. Info(info, msg string) // Warning logs a warning message. Warning(info, msg string) // Error logs an error message. Error(info, msg string) // Critical logs a critical error message. Critical(info, msg string) // Fatal logs a fatal error message. Fatal(info, msg string) }
Logger is the interface for different logger backends.
func NewGoLogger ¶
func NewGoLogger() Logger
NewGoLogger returns a logger implementation using the Go log package.
func NewStandardLogger ¶
NewStandardLogger creates the standard logger writing to the passed output.
func NewSysLogger ¶
NewGoLogger returns a logger implementation using the Go syslog package.
type StandardLogger ¶
type StandardLogger struct {
// contains filtered or unexported fields
}
StandardLogger is a simple logger writing to the given writer. Beside the output it doesn't handle the levels differently.
func (*StandardLogger) Critical ¶
func (sl *StandardLogger) Critical(info, msg string)
Critical is specified on the Logger interface.
func (*StandardLogger) Debug ¶
func (sl *StandardLogger) Debug(info, msg string)
Debug is specified on the Logger interface.
func (*StandardLogger) Error ¶
func (sl *StandardLogger) Error(info, msg string)
Error is specified on the Logger interface.
func (*StandardLogger) Fatal ¶
func (sl *StandardLogger) Fatal(info, msg string)
Fatal is specified on the Logger interface.
func (*StandardLogger) Info ¶
func (sl *StandardLogger) Info(info, msg string)
Info is specified on the Logger interface.
func (*StandardLogger) Warning ¶
func (sl *StandardLogger) Warning(info, msg string)
Warning is specified on the Logger interface.
type SysLogger ¶
type SysLogger struct {
// contains filtered or unexported fields
}
SysLogger uses the Go syslog package as logging backend. It does not work on Windows or Plan9.