private static final Logger LOGGER = LoggerFactory.getLogger(SCLReporting.class);
+ public static SCLReportingHandler getCurrentReportingHandler() {
+ SCLReportingHandler handler = ((SCLReportingHandler)SCLContext.getCurrent().get(SCLReportingHandler.REPORTING_HANDLER));
+ return handler == null ? SCLReportingHandler.DEFAULT : handler;
+ }
+
public static void print(String text) {
SCLReportingHandler handler = ((SCLReportingHandler)SCLContext.getCurrent().get(SCLReportingHandler.REPORTING_HANDLER));
if(handler != null)
context.put(SCLReportingHandler.REPORTING_HANDLER, handler);
}
}
+
+ public static Object printingToLogging(Function proc) {
+ SCLContext context = SCLContext.getCurrent();
+ SCLReportingHandler handler = (SCLReportingHandler)context.get(SCLReportingHandler.REPORTING_HANDLER);
+ if(handler == null)
+ handler = SCLReportingHandler.DEFAULT;
+
+ context.put(SCLReportingHandler.REPORTING_HANDLER, SCLReportingHandler.DEFAULT);
+
+ try {
+ return proc.apply(Tuple0.INSTANCE);
+ } finally {
+ context.put(SCLReportingHandler.REPORTING_HANDLER, handler);
+ }
+ }
}