mirror of
https://github.com/akyaiy/GoSally-mvp.git
synced 2026-01-06 22:52:25 +00:00
Refactor error handling and utility functions; remove deprecated code and improve logging
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user