public class SystemOutUtilities
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static int |
FILE
redirects stdout to a file named "jPicedtError.log"
|
static int |
STANDARD
doesn't redirect stdout to a file, ie redirect to console ; instead open a frame and displays the error message in it
|
Modifier and Type | Method and Description |
---|---|
void |
displayDialog(boolean state)
Sets the "displayDialog" flag, ie what must happen when an error message comes up and redir=FILE : do we open a JDialog
or simply write the error message to the log file ?
(obviously, calling this method if redir=STANDARD simply makes no sense)
|
static java.lang.String |
getErrorLogFile()
Return the path to error.log
|
static SystemOutUtilities |
instance()
intanciates singleton if it's null, then returns it
|
void |
redirect(int type)
Redirect to the stream of the given type
|
public static final int STANDARD
public static final int FILE
public static SystemOutUtilities instance()
public void redirect(int type)
type
- one of the predefinite SystemOutUtilities's redirection typespublic void displayDialog(boolean state)
state
- if currentRedir = FILE and :
- state==TRUE, enables opening a dialog box whenever some String is written to System.out
A "watchdog" Thread is created for that purpose : System.out is redirected to a pipe, which the Thread watches periodically.
- state==FALSE, redirect System.out directly to the "toFilePrintStream" FOS, and kill the watchdog Thread if it's still alive.
Otherwise (ie currentRedir = STANDARD), we do nothing.public static java.lang.String getErrorLogFile()
Submit a bug : syd@jpicedt.org