logging

package
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: Feb 8, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateLogger

func CreateLogger(writer io.Writer, instanceName string, level zerolog.Level, logOrigin bool) zerolog.Logger

CreateLogger creates a logger with the given writer, instance name and log level

func CreateLoggerWithConfig

func CreateLoggerWithConfig(config *config.AppConfig) (zerolog.Logger, error)

CreateLoggerWithConfig creates a logger based on the given config

func GetDefaultLogger

func GetDefaultLogger() zerolog.Logger

GetDefaultLogger create and configure default zerolog logger. It should be used before config is loaded

func GinMiddleware

func GinMiddleware(log zerolog.Logger) gin.HandlerFunc

GinMiddleware returns a middleware that logs requests using zerolog.

func SetGinMode

func SetGinMode(mode string)

SetGinMode sets the gin mode (debug, release, test). This function is safe to call multiple times, but will only set the mode once.

func SetGinWriters

func SetGinWriters(log *zerolog.Logger)

SetGinWriters sets GIN to use zerolog logger for debugPrint, recovery messages and every other events when it uses fmt.Fprint(DefaultWriter/DefaultErrorWriter, ...) https://github.com/gin-gonic/gin/issues/1877#issuecomment-552637900 This function is safe to call multiple times, but will only set the writers once.

Types

This section is empty.

Jump to

Keyboard shortcuts

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