Refactor error handling and utility functions; remove deprecated code and improve logging

This commit is contained in:
alex
2025-07-05 16:05:03 +03:00
parent b70819e976
commit 2fdc32ce9f
13 changed files with 132 additions and 162 deletions

View File

@@ -1,3 +1,6 @@
// Package logs provides a logger setup function that configures the logger based on the environment.
// It supports different logging levels for development and production environments.
// It uses the standard library's slog package for structured logging.
package logs
import (
@@ -5,11 +8,15 @@ import (
"os"
)
// Environment constants for logger setup
const (
envDev = "dev"
// envDev enables development logging with debug level
envDev = "dev"
// envProd enables production logging with info level
envProd = "prod"
)
// SetupLogger initializes and returns a logger based on the provided environment.
func SetupLogger(env string) *slog.Logger {
var log *slog.Logger
switch env {