reduce the log spam
This commit is contained in:
@@ -35,11 +35,12 @@ func (h *Handler) VmModify(w http.ResponseWriter, r *http.Request) {
|
|||||||
var event models.CloudEventReceived
|
var event models.CloudEventReceived
|
||||||
if err := json.Unmarshal(reqBody, &event); err != nil {
|
if err := json.Unmarshal(reqBody, &event); err != nil {
|
||||||
h.Logger.Error("unable to decode json", "error", err)
|
h.Logger.Error("unable to decode json", "error", err)
|
||||||
|
prettyPrint(reqBody)
|
||||||
http.Error(w, "Invalid JSON body", http.StatusBadRequest)
|
http.Error(w, "Invalid JSON body", http.StatusBadRequest)
|
||||||
return
|
return
|
||||||
} else {
|
} else {
|
||||||
h.Logger.Debug("successfully decoded JSON")
|
h.Logger.Debug("successfully decoded JSON")
|
||||||
prettyPrint(event)
|
//prettyPrint(event)
|
||||||
}
|
}
|
||||||
|
|
||||||
if event.CloudEvent.Data.ConfigChanges == nil {
|
if event.CloudEvent.Data.ConfigChanges == nil {
|
||||||
@@ -50,7 +51,7 @@ func (h *Handler) VmModify(w http.ResponseWriter, r *http.Request) {
|
|||||||
} else {
|
} else {
|
||||||
h.Logger.Debug("Received event contains config change info")
|
h.Logger.Debug("Received event contains config change info")
|
||||||
configChanges = h.processConfigChanges(event.CloudEvent.Data.ConfigChanges.Modified)
|
configChanges = h.processConfigChanges(event.CloudEvent.Data.ConfigChanges.Modified)
|
||||||
prettyPrint(configChanges)
|
//prettyPrint(configChanges)
|
||||||
|
|
||||||
var found = false
|
var found = false
|
||||||
// Only interested in vCPU or ram changes currently
|
// Only interested in vCPU or ram changes currently
|
||||||
@@ -134,6 +135,7 @@ func (h *Handler) VmModify(w http.ResponseWriter, r *http.Request) {
|
|||||||
} else {
|
} else {
|
||||||
w.WriteHeader(http.StatusAccepted)
|
w.WriteHeader(http.StatusAccepted)
|
||||||
fmt.Fprintf(w, "Processed update event but no config changes were of interest\n")
|
fmt.Fprintf(w, "Processed update event but no config changes were of interest\n")
|
||||||
|
prettyPrint(configChanges)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user