logging

package
v0.0.0-...-6e892aa Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2025 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// RequestIDKey is the key used to store request IDs in context
	RequestIDKey contextKey = "request_id"
)

Variables

This section is empty.

Functions

func FromContext

func FromContext(ctx context.Context) zerolog.Logger

FromContext extracts a logger with request context

func Setup

func Setup(cfg Config)

Setup configures global logging based on the provided config

func StreamServerInterceptor

func StreamServerInterceptor() grpc.StreamServerInterceptor

StreamServerInterceptor returns a gRPC interceptor for streaming request logging

func UnaryServerInterceptor

func UnaryServerInterceptor() grpc.UnaryServerInterceptor

LoggingInterceptor returns a gRPC interceptor for request logging

Types

type Config

type Config struct {
	// Level is the logging level (debug, info, warn, error)
	Level string
	// Pretty determines if logs should be formatted for human readability
	Pretty bool
	// Output is where logs are written (defaults to os.Stdout)
	Output io.Writer
}

Config defines logging configuration

func DefaultConfig

func DefaultConfig() Config

DefaultConfig returns the default logging configuration

Jump to

Keyboard shortcuts

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