separate log functions

This commit is contained in:
Andreas Brett 2021-11-15 17:52:28 +01:00
parent d21f7971b5
commit e5913c5abc
15 changed files with 230 additions and 203 deletions

View file

@ -1,5 +1,5 @@
const PrometheusClient = require("prom-client");
const { log } = require("../src/util");
const { log_error } = require("../src/util");
const commonLabels = [
"monitor_name",
@ -57,23 +57,23 @@ class Prometheus {
}
monitor_cert_is_valid.set(this.monitorLabelValues, is_valid);
} catch (e) {
log("prometheus", "Caught error", "error");
log("prometheus", e, "error");
log_error("prometheus", "Caught error");
log_error("prometheus", e);
}
try {
monitor_cert_days_remaining.set(this.monitorLabelValues, tlsInfo.certInfo.daysRemaining);
} catch (e) {
log("prometheus", "Caught error", "error");
log("prometheus", e, "error");
log_error("prometheus", "Caught error");
log_error("prometheus", e);
}
}
try {
monitor_status.set(this.monitorLabelValues, heartbeat.status);
} catch (e) {
log("prometheus", "Caught error", "error");
log("prometheus", e, "error");
log_error("prometheus", "Caught error");
log_error("prometheus", e);
}
try {
@ -84,8 +84,8 @@ class Prometheus {
monitor_response_time.set(this.monitorLabelValues, -1);
}
} catch (e) {
log("prometheus", "Caught error", "error");
log("prometheus", e, "error");
log_error("prometheus", "Caught error");
log_error("prometheus", e);
}
}