logging

package
v0.0.0-...-5106b98 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2026 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ContextAttrs

func ContextAttrs(ctx context.Context) []slog.Attr

ContextAttrs returns standard correlation attributes from context.

func HTTPMiddleware

func HTTPMiddleware(logger *slog.Logger, logBodies bool) fiber.Handler

HTTPMiddleware returns a Fiber middleware that logs full HTTP requests and responses

func LogError

func LogError(ctx context.Context, message string, err error, sensitiveValues ...string)

LogError records a safe error diagnostic at a boundary that returns a sanitized error.

func LogMethodCompletion

func LogMethodCompletion(ctx context.Context, logger *slog.Logger, completion MethodCompletion)

LogMethodCompletion logs one method completion event for generated decorators.

func Setup

func Setup(cfg Config, component string) (*slog.Logger, io.Closer, error)

Setup creates a logger with file rotation and stdout output

func WithAttrs

func WithAttrs(ctx context.Context, attrs ...slog.Attr) context.Context

WithAttrs attaches allowlisted log attributes to ctx.

Types

type Config

type Config struct {
	Level            string
	FilePath         string
	RotationInterval time.Duration
	MaxFileSizeMB    int
	Environment      string
	OTLPLogsEndpoint string
}

Config contains logging configuration

type MethodCompletion

type MethodCompletion struct {
	Layer       string
	Package     string
	Interface   string
	Method      string
	StartedAt   time.Time
	CompletedAt time.Time
	Err         error
}

MethodCompletion describes one completed decorated interface method call.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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