logger

package
v1.0.3-rc Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2025 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateLogger

func CreateLogger() *logrus.Logger

Configure and initialize a new Logrus logger instance based on environment variables.

func GetLogLevel

func GetLogLevel(level string) logrus.Level

Convert a string value into the corresponding logrus.Level type where the default value is a info log level - supports various logging levels, like Trace, Debug, Info, Warning, Error, Fatal, and Panic, in increasing order of severity.

func HttpRequesLogger

func HttpRequesLogger(logger *logrus.Logger) func(next http.Handler) http.Handler

Create and configure an HTTP request logging middleware using the logrus library.

Types

type Logger

type Logger struct {
	Logger *logrus.Logger
}

type StructuredLogger

type StructuredLogger struct {
	Logger *logrus.Logger
}

func (*StructuredLogger) NewLogEntry

func (l *StructuredLogger) NewLogEntry(r *http.Request) middleware.LogEntry

Create a new structured log entry for an incoming HTTP request within a logging middleware, the entry format is designed to play nice with logrus library for logging.

type StructuredLoggerEntry

type StructuredLoggerEntry struct {
	Logger logrus.FieldLogger
}

func (*StructuredLoggerEntry) Panic

func (l *StructuredLoggerEntry) Panic(v interface{}, stack []byte)

Handle and log panic situations within a structured logging context.

func (*StructuredLoggerEntry) Write

func (l *StructuredLoggerEntry) Write(status, bytes int, header http.Header, elapsed time.Duration, extra interface{})

Log details about the HTTP response after it has been sent to the client

Jump to

Keyboard shortcuts

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