importJava "org.slf4j.MarkerFactory" where
// Note: this method is pure by purpose, because MarkerFactory should always return the same marker
@JavaName getMarker
- marker :: String -> Marker
\ No newline at end of file
+ marker :: String -> Marker
+
+importJava "org.simantics.scl.runtime.reporting.SCLReporting" where
+ "Redirects print commands to INFO level logging and printErrors to ERROR level logging."
+ printingToLogging :: (<e> a) -> <e> a
\ No newline at end of file
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);
+ }
+ }
}