import org.simantics.scl.compiler.types.Type;
import org.simantics.scl.runtime.function.Function;
import org.simantics.scl.runtime.function.Function2;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
public class CommandSerializerFactory {
+ private static final Logger LOGGER = LoggerFactory.getLogger(CommandSerializerFactory.class);
@SuppressWarnings("unchecked")
public static CommandSerializer create(String name, Type[] parameterTypes) {
Function2<Resource,Object,String>[] stringConverters = new Function[parameterTypes.length];
try {
stringConverters[i] = StringConverterFactory.stringConverterFor(parameterTypes[i]);
} catch(SCLExpressionCompilationException e) {
- System.err.println("Failed to create a string converter for type " + parameterTypes[i] + ".");
- System.err.println(CompilationErrorFormatter.toString(e.getErrors()));
+ LOGGER.error("Failed to create a string converter for type " + parameterTypes[i] + ".");
+ LOGGER.error(CompilationErrorFormatter.toString(e.getErrors()), e);
return new ErrorSerializer(name);
} catch (ImportFailureException e) {
- System.err.println("Failed to create a string converter for type " + parameterTypes[i] + ".");
- System.err.println("Didn't find Simantics/GShow/gshow.");
+ LOGGER.error("Failed to create a string converter for type " + parameterTypes[i] + ".");
+ LOGGER.error("Didn't find Simantics/GShow/gshow.", e);
return new ErrorSerializer(name);
}
}