logger

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 5, 2025 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InitLogger

func InitLogger(mode string) *slog.Logger

Inits the go standart logger, based on env mode.

func LogFunc added in v1.0.0

func LogFunc(
	ctx context.Context,
	logger *slog.Logger,
	funcName string,
	err error,
	extraAttrs ...slog.Attr,
)

LogFunc logs a function call with optional extra attributes. It records the request ID from context and any error passed. Timing is NOT recorded here. Use this when you only want to log function entry or results without measuring duration.

func LogFuncWithTiming added in v1.0.0

func LogFuncWithTiming(
	ctx context.Context,
	logger *slog.Logger,
	funcName string,
	begin time.Time,
	err error,
	extraAttrs ...slog.Attr,
)

LogFuncWithTiming logs a function call including the elapsed time since `begin`. It records the request ID from context, the duration, any error, and optional extra attributes. Use this when you want to measure and log the time taken by a function.

Types

This section is empty.

Jump to

Keyboard shortcuts

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