grace.log
Class PrintCatcher
java.lang.Object
|
+--java.io.OutputStream
|
+--java.io.FilterOutputStream
|
+--java.io.PrintStream
|
+--grace.log.PrintCatcher
- public class PrintCatcher
- extends java.io.PrintStream
This class allows the user of JavaLog to use existing
System.out.print statements in legacy code, but route the output of
those statements through the JavaLog formatting system. This is
accomplished by installing one instance of this class in place of
the System output or error stream using the
System.setOut()
or System.setErr()
functions.
The best way to use the class is to use the static functions
install, installOut, or installErr
. These will
install PrintCatchers for out and err, only out, or only err,
respectively.
Field Summary |
static java.lang.String |
rcsid
|
Fields inherited from class java.io.FilterOutputStream |
out |
Method Summary |
java.io.PrintStream |
getOriginalStream()
|
static void |
install()
Installs a PrintCatcher over the standard output and one over
the standard error. |
static void |
installErr()
Installs a new PrintCatcher on the standard err using
Log.ERROR as the event type. |
static void |
installErr(java.lang.String eventType)
Installs a new PrintCatcher on the standard err using the given
event type. |
static void |
installOut()
Installs a new PrintCatcher on the standard out using
Log.NOTICE as the event type. |
static void |
installOut(java.lang.String eventType)
Installs a new PrintCatcher on the standard out using the given
event type. |
void |
print(boolean v)
|
void |
print(char v)
|
void |
print(char[] v)
|
void |
print(double v)
|
void |
print(java.lang.Exception exception)
|
void |
print(float v)
|
void |
print(int v)
|
void |
print(long v)
|
void |
print(java.lang.Object object)
|
void |
print(java.lang.String v)
|
protected void |
print(java.lang.String message,
int level)
|
void |
println(boolean v)
|
void |
println(char v)
|
void |
println(char[] v)
|
void |
println(double v)
|
void |
println(float v)
|
void |
println(int v)
|
void |
println(long v)
|
void |
println(java.lang.String v)
|
protected void |
println(java.lang.String message,
int level)
|
void |
setBufferedPrints(boolean buffered)
|
static void |
uninstall()
Replaces any PrintCatchers previously installed as the standard
output and standard error with original standard out and error. |
Methods inherited from class java.io.PrintStream |
checkError,
close,
flush,
println,
println,
setError,
write,
write |
Methods inherited from class java.io.FilterOutputStream |
write |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
rcsid
public static final java.lang.String rcsid
PrintCatcher
public PrintCatcher()
PrintCatcher
public PrintCatcher(java.lang.String eventType)
PrintCatcher
public PrintCatcher(java.lang.String eventType,
java.io.PrintStream stream)
install
public static void install()
- Installs a PrintCatcher over the standard output and one over
the standard error.
- See Also:
installOut
,
installErr
uninstall
public static void uninstall()
- Replaces any PrintCatchers previously installed as the standard
output and standard error with original standard out and error.
installOut
public static void installOut()
- Installs a new PrintCatcher on the standard out using
Log.NOTICE as the event type.
installOut
public static void installOut(java.lang.String eventType)
- Installs a new PrintCatcher on the standard out using the given
event type.
installErr
public static void installErr()
- Installs a new PrintCatcher on the standard err using
Log.ERROR as the event type.
installErr
public static void installErr(java.lang.String eventType)
- Installs a new PrintCatcher on the standard err using the given
event type.
getOriginalStream
public java.io.PrintStream getOriginalStream()
setBufferedPrints
public void setBufferedPrints(boolean buffered)
print
public void print(char v)
- Overrides:
- print in class java.io.PrintStream
println
public void println(char v)
- Overrides:
- println in class java.io.PrintStream
print
public void print(char[] v)
- Overrides:
- print in class java.io.PrintStream
println
public void println(char[] v)
- Overrides:
- println in class java.io.PrintStream
print
public void print(boolean v)
- Overrides:
- print in class java.io.PrintStream
println
public void println(boolean v)
- Overrides:
- println in class java.io.PrintStream
print
public void print(int v)
- Overrides:
- print in class java.io.PrintStream
println
public void println(int v)
- Overrides:
- println in class java.io.PrintStream
print
public void print(long v)
- Overrides:
- print in class java.io.PrintStream
println
public void println(long v)
- Overrides:
- println in class java.io.PrintStream
print
public void print(float v)
- Overrides:
- print in class java.io.PrintStream
println
public void println(float v)
- Overrides:
- println in class java.io.PrintStream
print
public void print(double v)
- Overrides:
- print in class java.io.PrintStream
println
public void println(double v)
- Overrides:
- println in class java.io.PrintStream
print
public void print(java.lang.String v)
- Overrides:
- print in class java.io.PrintStream
println
public void println(java.lang.String v)
- Overrides:
- println in class java.io.PrintStream
print
protected void print(java.lang.String message,
int level)
println
protected void println(java.lang.String message,
int level)
print
public void print(java.lang.Object object)
- Overrides:
- print in class java.io.PrintStream
print
public void print(java.lang.Exception exception)