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 Info(args ...interface{})
- func Infof(format string, args ...interface{})
- func SetHandlers(handlers ...Handler)
- func SetLevel(level Level)
- type Handler
- type Level
- type Logger
- type Record
Constants ¶
const ( // DebugLevel level. Usually only enabled when debugging. Very verbose logging. DebugLevel = Level(log.LvlDebug) // InfoLevel level. General operational entries about what's going on inside the // application. InfoLevel = Level(log.LvlInfo) // ErrorLevel level. Logs. Used for errors that should definitely be noted. // Commonly used for hooks to send errors to an error tracking service. ErrorLevel = Level(log.LvlError) // FatalLevel level. Logs and then calls `os.Exit(1)`. FatalLevel = Level(log.LvlCrit) )
Variables ¶
This section is empty.
Functions ¶
func Debug ¶
func Debug(args ...interface{})
Debug logs a message at level Debug on the standard logger.
func Debugf ¶
func Debugf(format string, args ...interface{})
Debugf logs a message at level Debug on the standard logger.
func Error ¶
func Error(args ...interface{})
Error logs a message at level Error on the standard logger.
func Errorf ¶
func Errorf(format string, args ...interface{})
Errorf logs a message at level Error on the standard logger.
func Fatal ¶
func Fatal(args ...interface{})
Fatal logs a message at level Fatal on the standard logger.
func Fatalf ¶
func Fatalf(format string, args ...interface{})
Fatalf logs a message at level Fatal on the standard logger.
func Info ¶
func Info(args ...interface{})
Info logs a message at level Info on the standard logger.
func Infof ¶
func Infof(format string, args ...interface{})
Infof logs a message at level Info on the standard logger.
func SetHandlers ¶
func SetHandlers(handlers ...Handler)
SetHandlers allows you to set extra handlers on the std logger, besides the default StdErr Logger
Types ¶
type Handler ¶
Handler interface defines where and how log records are written. Handlers are composable, providing you great flexibility in combining them to achieve the logging structure that suits your applications.
func EmailHandler ¶
func EmailHandler(minLevel Level, module string, to []string, from, smtp string, auth smtp.Auth) (Handler, error)
EmailHandler returns a handler which sends an email to the given email address in case a logged record is of the specified minimum level
func FileHandler ¶
FileHandler returns a handler which writes log records to the give file using the given format. If the path already exists, FileHandler will append to the given file. If it does not, FileHandler will create the file with mode 0644.
func StderrHandler ¶
func StderrHandler() Handler
StderrHandler is the default handler for all logs, unless handlers are given
func SyslogHandler ¶
SyslogHandler opens a connection to the system syslog daemon by calling syslog.New and writes all records to it.
type Logger ¶
type Logger interface { // verbose messages targeted at the developer Debug(args ...interface{}) Debugf(format string, args ...interface{}) // info messages targeted at the user and developer Info(args ...interface{}) Infof(format string, args ...interface{}) // error messages targeted at the user, sysadmin and developer, // but mostly at the sysadmin Error(args ...interface{}) Errorf(format string, args ...interface{}) // a fatal message targeted at the user and developer // the program will exit as this message // this level shouldn't be used by libraries Fatal(args ...interface{}) Fatalf(format string, args ...interface{}) }
Logger defines a pragmatic Logger interface.