clean config.go

This commit is contained in:
SowinskiBraeden committed 2022-10-03 08:39:49 -07:00
1 parent 347db9f86f
commit 1414e243b4
1 file changed
+6 -6
+6 -6
View File
@@ -52,18 +52,18 @@ func ErrorStatus(message string, httpStatusCode int, w http.ResponseWriter, err
w.WriteHeader(httpStatusCode) w.WriteHeader(httpStatusCode)
b, _ := json.Marshal(models.ErrorMessageResponse{Response: models.MessageError{Message: message, Error: err.Error()}}) b, _ := json.Marshal(models.ErrorMessageResponse{Response: models.MessageError{Message: message, Error: err.Error()}})
w.Write(b) w.Write(b)
return
} }
// setLogger is a helper function to set the Logger based on the environment // setLogger is a helper function to set the Logger based on the environment
func setLogger(env string) (*zap.Logger, error) { func setLogger(env string) (*zap.Logger, error) {
if env == "production" { switch env {
case "production":
return zap.NewProduction() return zap.NewProduction()
} else if env == "development" { case "development":
return zap.NewDevelopment() return zap.NewDevelopment()
} else if env == "local" { case "local":
return zap.NewExample(), nil return zap.NewExample(), nil
} else { default:
return zap.NewExample(), fmt.Errorf("cannot find ENV car so defaulting to debug level logging") return zap.NewExample(), fmt.Errorf("cannon find ENV car so defaulting to debug logging")
} }
} }