public class EchoLogger
extends java.lang.Object
| Constructor and Description |
|---|
EchoLogger() |
| Modifier and Type | Method and Description |
|---|---|
static EchoLogger |
getInstance()
Return the unique instance.
|
void |
log(java.lang.Object o)
Log one Object to the underlying PrintStream or the standard output Stream.
|
void |
setPrintStream(java.io.PrintStream stream)
Set the printStream to use for the echo keyword.
|
public static EchoLogger getInstance()
public void setPrintStream(java.io.PrintStream stream)
public class ErrorStream extends ByteArrayOutputStream {
public ErrorStream() {
super();
}
public void flush() throws IOException {
synchronized (this) {
super.flush();
String result = this.toString();
System.out.err(result);
super.reset();
}
}
}
A simple way to wrap an OutputStream like this one to a PrintStream is performed just by:
ErrorStream errorStream = new ErrorStream(); PrintStream stream = new PrintStream(errorStream);
stream - the PrintStreampublic void log(java.lang.Object o)
o - the ObjectExprECHOCopyright © 2018 Herve Girod. All Rights Reserved. Documentation and source under the BSD licence