use of org.openremote.model.syslog.SyslogConfig in project openremote by openremote.
the class SyslogService method init.
@Override
public void init(Container container) throws Exception {
executorService = container.getService(ManagerExecutorService.class);
if (container.hasService(ClientEventService.class) && container.hasService(PersistenceService.class)) {
LOG.info("Syslog service enabled");
clientEventService = container.getService(ClientEventService.class);
persistenceService = container.getService(PersistenceService.class);
} else {
LOG.info("Syslog service disabled, missing required services");
}
if (clientEventService != null) {
clientEventService.addSubscriptionAuthorizer((auth, subscription) -> {
// Only superuser can get logging events
return subscription.isEventType(SyslogEvent.class) && auth.isSuperUser();
});
}
if (container.hasService(WebService.class)) {
container.getService(WebService.class).getApiSingletons().add(new SyslogResourceImpl(this));
}
// Default config: Store all INFO messages for five days
config = new SyslogConfig(SyslogLevel.INFO, SyslogCategory.values(), 60 * 24 * 5);
}
Aggregations