public RedwoodConfiguration restore(final OutputStream stream) { if (stream == System.out) { tasks.add(() -> Redwood.captureSystemStreams(false, Redwood.realSysErr == System.err)); } else if (stream == System.err) { tasks.add(() -> Redwood.captureSystemStreams(Redwood.realSysOut == System.out, false)); } else { throw new IllegalArgumentException("Must capture one of stderr or stdout"); } return this; }
/** * Capture a system stream. * * @param stream The stream to capture; one of System.out or System.err * @return this */ public RedwoodConfiguration capture(final OutputStream stream) { // Capture the stream if (stream == System.out) { tasks.add(() -> Redwood.captureSystemStreams(true, Redwood.realSysErr == System.err)); } else if (stream == System.err) { tasks.add(() -> Redwood.captureSystemStreams(Redwood.realSysOut == System.out, true)); } else { throw new IllegalArgumentException("Must capture one of stderr or stdout"); } return this; }
Redwood.captureSystemStreams(true, true); System.out.println("Hello World"); log.info("This is an error!");
tasks.add(new Runnable() { public void run() { Redwood.captureSystemStreams(Redwood.realSysOut == System.out, true); } }); } else {
tasks.add(new Runnable() { public void run() { Redwood.captureSystemStreams(false, Redwood.realSysErr == System.err); } }); } else if (stream == System.err) {
tasks.add(new Runnable() { public void run() { Redwood.captureSystemStreams(true, Redwood.realSysErr == System.err); } }); } else if (stream == System.err) {
tasks.add(new Runnable() { public void run() { Redwood.captureSystemStreams(Redwood.realSysOut == System.out, false); } }); } else {
public RedwoodConfiguration restore(final OutputStream stream) { if (stream == System.out) { tasks.add(() -> Redwood.captureSystemStreams(false, Redwood.realSysErr == System.err)); } else if (stream == System.err) { tasks.add(() -> Redwood.captureSystemStreams(Redwood.realSysOut == System.out, false)); } else { throw new IllegalArgumentException("Must capture one of stderr or stdout"); } return this; }
public RedwoodConfiguration restore(final OutputStream stream) { if (stream == System.out) { tasks.add(() -> Redwood.captureSystemStreams(false, Redwood.realSysErr == System.err)); } else if (stream == System.err) { tasks.add(() -> Redwood.captureSystemStreams(Redwood.realSysOut == System.out, false)); } else { throw new IllegalArgumentException("Must capture one of stderr or stdout"); } return this; }
/** * Capture a system stream. * * @param stream The stream to capture; one of System.out or System.err * @return this */ public RedwoodConfiguration capture(final OutputStream stream) { // Capture the stream if (stream == System.out) { tasks.add(() -> Redwood.captureSystemStreams(true, Redwood.realSysErr == System.err)); } else if (stream == System.err) { tasks.add(() -> Redwood.captureSystemStreams(Redwood.realSysOut == System.out, true)); } else { throw new IllegalArgumentException("Must capture one of stderr or stdout"); } return this; }
/** * Capture a system stream. * * @param stream The stream to capture; one of System.out or System.err * @return this */ public RedwoodConfiguration capture(final OutputStream stream) { // Capture the stream if (stream == System.out) { tasks.add(() -> Redwood.captureSystemStreams(true, Redwood.realSysErr == System.err)); } else if (stream == System.err) { tasks.add(() -> Redwood.captureSystemStreams(Redwood.realSysOut == System.out, true)); } else { throw new IllegalArgumentException("Must capture one of stderr or stdout"); } return this; }
Redwood.captureSystemStreams(true, true); System.out.println("Hello World"); log.info("This is an error!");
Redwood.captureSystemStreams(true, true); System.out.println("Hello World"); log.info("This is an error!");
Redwood.captureSystemStreams(true, true); System.out.println("Hello World"); System.err.println("This is an error!");