Improve logging in metric updater

This commit is contained in:
RuscalWorld 2022-07-26 16:22:05 +03:00
parent 2b402382f8
commit b9a4d7eea4
No known key found for this signature in database
GPG key ID: 6FF416979DF2B416

View file

@ -1,5 +1,7 @@
package ru.ruscalworld.fabricexporter;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import ru.ruscalworld.fabricexporter.metrics.Metric;
import java.util.ArrayList;
@ -7,6 +9,7 @@ import java.util.List;
import java.util.TimerTask;
public class MetricUpdater extends TimerTask {
private final static Logger logger = LoggerFactory.getLogger("MetricUpdater");
private final List<Metric> metrics = new ArrayList<>();
private final FabricExporter exporter;
@ -20,7 +23,7 @@ public class MetricUpdater extends TimerTask {
try {
metric.update(this.getExporter());
} catch (Exception exception) {
exception.printStackTrace();
logger.error("Error updating metric " + metric.getName(), exception);
}
}
}