logging

package
v0.0.0-...-1687775 Latest Latest
Warning

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

Go to latest
Published: Dec 28, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package logging provides centralized logging functionality for the application. Version: 1.0.0

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoggerMiddleware

func LoggerMiddleware(logger *zap.Logger) func(next http.Handler) http.Handler

LoggerMiddleware provides a middleware for logging HTTP requests

func NewLogger

func NewLogger(component string) (*zap.Logger, error)

NewLogger creates or returns the singleton logger instance

func RecoveryMiddleware

func RecoveryMiddleware(logger *zap.Logger) func(next http.Handler) http.Handler

RecoveryMiddleware provides a middleware for recovering from panics

func Sync

func Sync() error

Sync flushes any buffered log entries

func WithContext

func WithContext(logger *zap.Logger, fields map[string]interface{}) *zap.Logger

WithContext adds context fields to the logger

Types

type LoggerConfig

type LoggerConfig struct {
	LogPath       string
	MaxSize       int // megabytes
	MaxBackups    int
	MaxAge        int // days
	Compress      bool
	Development   bool
	EnableConsole bool
}

LoggerConfig represents the configuration for the logger

Jump to

Keyboard shortcuts

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