Redirects all output sent to System.out to ImageJ's log console. @param prefix The prefix string inserted at the start of each output line. Pass null to use the default prefix or an empty string to remove the prefix.
(String prefix)
| 55 | * remove the prefix. |
| 56 | */ |
| 57 | public static void redirectSystemOut(String prefix) { |
| 58 | if (originalSystemOut == null) { // has no effect if System.out is already replaced |
| 59 | originalSystemOut = System.out; // remember the original System.out stream |
| 60 | temporarySystemOut = new LogStream(prefix); |
| 61 | System.setOut(temporarySystemOut); |
| 62 | } |
| 63 | } |
| 64 | |
| 65 | /** |
| 66 | * Redirects all output sent to <code>System.err</code> to ImageJ's log console. |