package jalview.util; public class ErrorLog { private static boolean hasConsole = true; public static void outPrintln(String message) { println(message, false); } public static void errPrintln(String message) { println(message, true); } public static void println(String message, boolean err) { if (hasConsole) { try { hasConsole = jalview.bin.Console.initLogger(); if (hasConsole) { if (err) { jalview.bin.Console.errPrintln(message); } else { jalview.bin.Console.outPrintln(message); } } } catch (Exception e) { e.printStackTrace(); } catch (NoClassDefFoundError t) { hasConsole = false; System.err.println( "jalview.util.ErrorLog has no jalview.bin.Console. Using System.err and System.out."); } } if (!hasConsole) { if (err) { System.err.println("jalview.util.ErrorLog: " + message); } else { System.out.println("jalview.util.ErrorLog: " + message); } } } }