logging

package
v1.2.3 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type LogLevel

type LogLevel int64

LogLevel level of log output

const (
	// OnlyError logs just error cases, recommended for production use
	OnlyError LogLevel = iota
	// Verbose logs additional informations
	Verbose
	// Debug logs information for debugging use cases
	Debug
)

func ParseLogLevel

func ParseLogLevel(ll int) LogLevel

ParseLogLevel parses the LogLevel from an integer value.

func (LogLevel) String

func (l LogLevel) String() string

String gets the string representation of the LogLevel

type LoggerUtil

type LoggerUtil struct {
	Level LogLevel
	// contains filtered or unexported fields
}

LoggerUtil a helper for log output

func NewLoggerUtil

func NewLoggerUtil(logLevel LogLevel) *LoggerUtil

NewLoggerUtil creates an instance of LoggerUtil

func (*LoggerUtil) LogError

func (l *LoggerUtil) LogError(formattedMessage string, err error)

LogError logs an error case

func (*LoggerUtil) LogIncomingRequest

func (l *LoggerUtil) LogIncomingRequest(request *http.Request)

LogIncomingRequest helper for logging http requests

func (*LoggerUtil) LogWhenDebug

func (l *LoggerUtil) LogWhenDebug(formattedMessage string)

LogWhenDebug logs a message for debugging purposes

func (*LoggerUtil) LogWhenVerbose

func (l *LoggerUtil) LogWhenVerbose(formattedMessage string)

LogWhenVerbose logs an additional information

type ResponseWriter added in v0.0.13

type ResponseWriter struct {
	http.ResponseWriter
	// contains filtered or unexported fields
}

ResponseWriter is a helper for logging http responses

func NewResponseWriter added in v0.0.13

func NewResponseWriter(writer http.ResponseWriter, logger *LoggerUtil, skip int) *ResponseWriter

NewResponseWriter creates a new instance of ResponseWriter

func (*ResponseWriter) Log added in v0.0.13

func (lrw *ResponseWriter) Log()

Log logs the response body

func (*ResponseWriter) Write added in v0.0.13

func (lrw *ResponseWriter) Write(p []byte) (int, error)

func (*ResponseWriter) WriteHeader added in v0.0.13

func (lrw *ResponseWriter) WriteHeader(code int)

WriteHeader writes the response status code

Jump to

Keyboard shortcuts

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