Documentation
¶
Index ¶
- Constants
- func Debug(msg string, a ...interface{})
- func DebugEnabled() bool
- func Default() *extendedLogger
- func Error(msg string, a ...interface{})
- func Fatal(msg string, a ...interface{})
- func Info(msg string, a ...interface{})
- func IsRequestLoggingActive() bool
- func IsResponseLoggingActive() bool
- func LogRequest(id string, request *http.Request) error
- func LogResponse(id string, response *http.Response, body string) error
- func New(consoleLogger, fileLogger *log.Logger, level logLevel) *extendedLogger
- func SetupLogging(fs afero.Fs, optionalAddedLogger *log.Logger)
- func Warn(msg string, a ...interface{})
Constants ¶
const ( LevelFatal logLevel = iota LevelError LevelWarn LevelInfo LevelDebug )
Variables ¶
This section is empty.
Functions ¶
func Debug ¶
func Debug(msg string, a ...interface{})
Debug logs the message with the prefix DEBUG to the default logger (see Default()).
func DebugEnabled ¶
func DebugEnabled() bool
func Default ¶
func Default() *extendedLogger
Default returns the default logger which is used, when functions like Info() and Debug() are called. The console logger will be the same default logger from the standard library, the level will be INFO and there's no file logger set up. The function SetupLogging() can be used to create a file logger.
func Error ¶
func Error(msg string, a ...interface{})
Error logs the message with the prefix ERROR to the default logger (see Default)).
func Fatal ¶
func Fatal(msg string, a ...interface{})
Fatal logs the message with the prefix FATAL to the default logger (see Default)).
func Info ¶
func Info(msg string, a ...interface{})
Info logs the message with the prefix INFO to the default logger (see Default()).
func IsRequestLoggingActive ¶
func IsRequestLoggingActive() bool
func IsResponseLoggingActive ¶
func IsResponseLoggingActive() bool
func New ¶
New creates a new extendedLogger, which contains two underlying loggers, a console logger and a file logger. The file logger will always print all logs, while the console logger will only print logs according to the level of this logger, e.g. at LevelInfo.
func SetupLogging ¶
SetupLogging is used to enable file logging, including Request and Response logs. If logging functions are called without setup, logging will only be done to stdout. Otherwise, the file logger will be set to a log file whose name will be the current timestamp, in the format of <YYYYMMDD-hhmmss>.log
Types ¶
This section is empty.