Add structured logging and centralized error handling
- Initialize slog in the serve command with terminal/file support - Introduce `AppError` with HTTP status for unified service-layer errors - Replace ad-hoc `api.Error` calls with `api.RespondError` - Wrap internal errors with `model.NewInternalError` and add reference IDs - Add `RequestID` middleware and switch router from `gin.Default` to `gin.New`
This commit is contained in:
@@ -27,6 +27,10 @@ func defaults(v *viper.Viper) {
|
||||
v.SetDefault("jwt.secret", "dev-secret-do-not-use-in-production")
|
||||
v.SetDefault("jwt.access_ttl", "15m")
|
||||
v.SetDefault("jwt.refresh_ttl", "168h")
|
||||
|
||||
v.SetDefault("log.level", "info")
|
||||
v.SetDefault("log.file_path", "")
|
||||
v.SetDefault("log.file_level", "debug")
|
||||
}
|
||||
|
||||
func New() *viper.Viper {
|
||||
|
||||
Reference in New Issue
Block a user