]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.scl.commands/src/org/simantics/scl/commands/internal/serialization/CommandSerializerFactory.java
Replace System.err and System.out with SLF4J Logging
[simantics/platform.git] / bundles / org.simantics.scl.commands / src / org / simantics / scl / commands / internal / serialization / CommandSerializerFactory.java
index 6f24e7d71b54d8323f79341741c218e4aafd8f37..70d2ad6a24f05e93bd8d1595f43421e9badde771 100644 (file)
@@ -8,8 +8,11 @@ import org.simantics.scl.compiler.top.SCLExpressionCompilationException;
 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];
@@ -17,12 +20,12 @@ public class CommandSerializerFactory {
             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);
             }
         }