log

package
v0.0.3-dev-docker-hub-... Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 27, 2023 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
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 LogRequest

func LogRequest(id string, request *http.Request) error

func LogResponse

func LogResponse(id string, response *http.Response, body string) error

func New

func New(consoleLogger, fileLogger *log.Logger, level logLevel) *extendedLogger

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

func SetupLogging(fs afero.Fs, optionalAddedLogger *log.Logger)

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

func Warn

func Warn(msg string, a ...interface{})

Warn logs the message with the prefix WARN to the default logger (see Default()).

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL