package cz.hobrasoft.pdfmu.operation;

import cz.hobrasoft.pdfmu.WritingMapper;
import cz.hobrasoft.pdfmu.TextOutput;
import cz.hobrasoft.pdfmu.Console;
import cz.hobrasoft.pdfmu.jackson.Result;
import cz.hobrasoft.pdfmu.jackson.RpcResponse;
import java.io.IOException;

public abstract class OperationCommon implements Operation {

    private WritingMapper wm = null;
    protected TextOutput to = new TextOutput(); // Discard messages by default

    @Override
    public void setWritingMapper(WritingMapper wm) {
        this.wm = wm;
    }

    protected void writeResult(Result result) {
        // Discard value if mapper was not set
        if (wm != null) {
            RpcResponse response = new RpcResponse(result);
            try {
                wm.writeValue(response);
            } catch (IOException ex) {
                Console.println(String.format("Error: Cannot write JSON document: %s", ex));
            }
        }
    }

    @Override
    public void setTextOutput(TextOutput to) {
        this.to = to;
    }
}

@@ -115,43 +115,8 @@
 ut;%0A
-import cz.hobrasoft.pdfmu.Console;%0A
 impo
@@ -153,16 +153,16 @@
 Result;%0A
+
 import c
@@ -227,16 +227,49 @@
 ception;
+%0Aimport java.util.logging.Logger;
 %0A%0Apublic
@@ -439,16 +439,108 @@
  default
+%0A    private static final Logger logger = Logger.getLogger(OperationCommon.class.getName());
 %0A%0A    @O
@@ -928,23 +928,21 @@
     
-Console.println
+logger.severe
 (Str
@@ -957,15 +957,8 @@
 at(%22
-Error: 
 Cann

Use a Logger instead of Console