- LoggerFinder.getLoggerFinder();
-
- // logging
- bundleContext.registerService(Consumer.class, ThinLoggerFinder.getConfigurationConsumer(),
- new Hashtable<>(Collections.singletonMap(Constants.SERVICE_PID, "argeo.logging.configuration")));
- bundleContext.registerService(Flow.Publisher.class, ThinLoggerFinder.getLogEntryPublisher(),
- new Hashtable<>(Collections.singletonMap(Constants.SERVICE_PID, "argeo.logging.publisher")));
-
+ LoggerFinder loggerFinder = LoggerFinder.getLoggerFinder();
+
+ if (loggerFinder instanceof Consumer<?> && loggerFinder instanceof Supplier<?>) {
+ @SuppressWarnings("unchecked")
+ Consumer<Map<String, Object>> consumer = (Consumer<Map<String, Object>>) loggerFinder;
+ // ThinLoggerFinder.getConfigurationConsumer()
+ // ThinLoggerFinder.getLogEntryPublisher()
+
+ @SuppressWarnings("unchecked")
+ Supplier<Flow.Publisher<Map<String, Serializable>>> supplier = (Supplier<Flow.Publisher<Map<String, Serializable>>>) loggerFinder;
+ // logging
+ bundleContext.registerService(Consumer.class, consumer,
+ new Hashtable<>(Collections.singletonMap(Constants.SERVICE_PID, "argeo.logging.configuration")));
+ bundleContext.registerService(Flow.Publisher.class, supplier.get(),
+ new Hashtable<>(Collections.singletonMap(Constants.SERVICE_PID, "argeo.logging.publisher")));
+ }