clean config.go
This commit is contained in:
1 file changed
+6
-6
+6
-6
@@ -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")
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user