From 1414e243b4df43bb15651e3a14500c734aed1838 Mon Sep 17 00:00:00 2001 From: Braeden Sowinski Date: Mon, 3 Oct 2022 08:39:49 -0700 Subject: [PATCH] clean config.go --- config/config.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/config/config.go b/config/config.go index d4397d5..f943935 100644 --- a/config/config.go +++ b/config/config.go @@ -52,18 +52,18 @@ func ErrorStatus(message string, httpStatusCode int, w http.ResponseWriter, err w.WriteHeader(httpStatusCode) b, _ := json.Marshal(models.ErrorMessageResponse{Response: models.MessageError{Message: message, Error: err.Error()}}) w.Write(b) - return } // setLogger is a helper function to set the Logger based on the environment func setLogger(env string) (*zap.Logger, error) { - if env == "production" { + switch env { + case "production": return zap.NewProduction() - } else if env == "development" { + case "development": return zap.NewDevelopment() - } else if env == "local" { + case "local": return zap.NewExample(), nil - } else { - return zap.NewExample(), fmt.Errorf("cannot find ENV car so defaulting to debug level logging") + default: + return zap.NewExample(), fmt.Errorf("cannon find ENV car so defaulting to debug logging") } }