feat: bootstrap foundation application
This commit is contained in:
24
apps/server/internal/logging/logging.go
Normal file
24
apps/server/internal/logging/logging.go
Normal file
@@ -0,0 +1,24 @@
|
||||
package logging
|
||||
|
||||
import (
|
||||
"log/slog"
|
||||
"os"
|
||||
"strings"
|
||||
)
|
||||
|
||||
func New(level string) *slog.Logger {
|
||||
var slogLevel slog.Level
|
||||
switch strings.ToUpper(level) {
|
||||
case "DEBUG":
|
||||
slogLevel = slog.LevelDebug
|
||||
case "WARN":
|
||||
slogLevel = slog.LevelWarn
|
||||
case "ERROR":
|
||||
slogLevel = slog.LevelError
|
||||
default:
|
||||
slogLevel = slog.LevelInfo
|
||||
}
|
||||
|
||||
handler := slog.NewTextHandler(os.Stdout, &slog.HandlerOptions{Level: slogLevel})
|
||||
return slog.New(handler)
|
||||
}
|
||||
Reference in New Issue
Block a user