Replace zerolog with log/slog from stdlib
- Rewrite logger package to use slog with LevelVar for dynamic levels - Update all packages to use *slog.Logger instead of *zerolog.Logger - Use TextHandler for TTY (dev), JSONHandler for production - Add make check target (runs lint + test) - Add make test target
This commit is contained in:
@@ -2,10 +2,10 @@ package config
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"log/slog"
|
||||
|
||||
"git.eeqj.de/sneak/gohttpserver/internal/globals"
|
||||
"git.eeqj.de/sneak/gohttpserver/internal/logger"
|
||||
"github.com/rs/zerolog"
|
||||
"github.com/spf13/viper"
|
||||
"go.uber.org/fx"
|
||||
|
||||
@@ -37,7 +37,7 @@ type Config struct {
|
||||
Port int
|
||||
SentryDSN string
|
||||
params *ConfigParams
|
||||
log *zerolog.Logger
|
||||
log *slog.Logger
|
||||
}
|
||||
|
||||
func New(lc fx.Lifecycle, params ConfigParams) (*Config, error) {
|
||||
@@ -69,9 +69,8 @@ func New(lc fx.Lifecycle, params ConfigParams) (*Config, error) {
|
||||
// Config file not found; ignore error if desired
|
||||
} else {
|
||||
// Config file was found but another error was produced
|
||||
log.Panic().
|
||||
Err(err).
|
||||
Msg("config file malformed")
|
||||
log.Error("config file malformed", "error", err)
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user