use of io.openems.impl.persistence.fenecon.FeneconPersistence in project openems by OpenEMS.
the class WebsocketLogAppender method append.
@Override
protected void append(ILoggingEvent event) {
long timestamp = event.getTimeStamp();
String level = event.getLevel().toString();
String source = event.getLoggerName();
String message = event.getFormattedMessage();
ThingRepository thingRepository = ThingRepository.getInstance();
for (Scheduler scheduler : thingRepository.getSchedulers()) {
for (Controller controller : scheduler.getControllers()) {
if (controller instanceof WebsocketApiController) {
WebsocketApiController websocketApiController = (WebsocketApiController) controller;
websocketApiController.sendLog(timestamp, level, source, message);
}
}
}
// send to fenecon persistence
ThingRepository.getInstance().getPersistences().forEach((persistence) -> {
if (persistence instanceof FeneconPersistence) {
FeneconPersistence p = (FeneconPersistence) persistence;
p.sendLog(timestamp, level, source, message);
}
});
}
Aggregations