|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--ec.util.Output
Outputs and logs system messages, errors, and other various items printed as a result of a run.
Output maintains zero or more logs, which contain Writers which write out stuff. Each log has an associated verbosity; if request is made to write text to a log, and the text's maximal verbosity is lower than the verbosity of the log, the log will not write it. Each Output instance also has an instance-level global verbosity; incoming requests to write text are additionally subject to this verbosity test. Lastly, the Output class itself has a global verbosity as well. This last verbostity is useful for shutting down writing to all logs in the entire system in a simple way.
When the system fails for some reason and must be started back up from a checkpoint, Output's log files may be overwritten. Output offers three approaches here. First, Output can clear the log file and overwrite it. Second, Output can append to the existing log file; because checkpoints are only done occasionally, this may result in duplicate outputs to a file, so keep this in mind. Third, Output can keep certain written text, typically announcements, in memory; this text gets written out into the checkpoint file, and so it is sound.
There are several kinds of announcements, in different levels of importance.
The default verbosity values for different kinds of announcements are given below:
0 | V_VERBOSE | (totally verbose) |
1000 | V_NO_MESSAGES | (don't print messages) |
2000 | V_NO_WARNINGS | (don't print warnings or messages) |
3000 | V_NO_GENERAL | (don't print warnings, messages, or other "general info" stuff that might come along (like statistics maybe)) |
4000 | V_NO_ERRORS | (don't even print errors) |
5000 | V_TOTALLY_SILENT | (be totally silent) |
Field Summary | |
static int |
ALL_LOGS
|
static int |
V_NO_ERRORS
Don't print warnings, messages, or simple errors |
static int |
V_NO_GENERAL
The standard verbosity to use if you don't want common reporting (like statistics) |
static int |
V_NO_MESSAGES
Don't print messages |
static int |
V_NO_WARNINGS
Don't print warnings or messages |
static int |
V_TOTALLY_SILENT
No verbosity at all, not even system messages or fatal errors |
static int |
V_VERBOSE
Total verbosity |
Constructor Summary | |
Output(boolean storeAnnouncementsInMemory,
int verbosity)
Creates a new, verbose, empty Output object. |
Method Summary | |
int |
addLog(java.io.File filename,
int verbosity,
boolean postAnnouncements,
boolean appendOnRestart)
Creates a new log of minimal verbosity verbosity and adds it to Output. |
int |
addLog(int descriptor,
int verbosity,
boolean postAnnouncements)
Creates a new log of minimal verbosity verbosity and adds it to Output. |
int |
addLog(Log l)
Adds the given log to Output. |
int |
addLog(java.io.Writer writer,
LogRestarter restarter,
int verbosity,
boolean postAnnouncements,
boolean repostAnnouncements)
Creates a new log of minimal verbosity verbosity and adds it to Output. |
void |
clearAnnouncements()
Clears out announcements. |
void |
clearErrors()
Clears the error flag. |
void |
error(java.lang.String s)
Posts a simple error. |
void |
error(java.lang.String s,
Parameter p1)
Posts a simple error. |
void |
error(java.lang.String s,
Parameter p1,
Parameter p2)
Posts a simple error. |
void |
exitIfErrors()
Exits with a fatal error if the error flag has been raised. |
void |
fatal(java.lang.String s)
Posts a fatal error. |
void |
fatal(java.lang.String s,
Parameter p1)
Posts a fatal error. |
void |
fatal(java.lang.String s,
Parameter p1,
Parameter p2)
Posts a fatal error. |
protected void |
finalize()
|
void |
flush()
Flushes the logs |
int |
getGlobalVerbosity()
Returns the global (static) verbosity of Output objects |
int |
getVerbosity()
Returns the Output object's general verbosity |
static void |
initialError(java.lang.String s)
Prints an initial error to System.err. |
static void |
initialError(java.lang.String s,
Parameter p1)
Prints an initial error to System.err. |
static void |
initialError(java.lang.String s,
Parameter p1,
Parameter p2)
Prints an initial error to System.err. |
Log |
log(int x)
Returns the given log. |
void |
message(java.lang.String s)
Posts a message. |
int |
numLogs()
Returns the number of logs currently posted. |
void |
print(java.lang.String s,
int _verbosity,
int log)
Prints a non-announcement message to a given log, with a certain verbosity. |
void |
print(java.lang.String s,
int _verbosity,
int[] _logs)
Prints a non-announcement message to the given logs, with a certain verbosity. |
protected void |
print(java.lang.String s,
int _verbosity,
Log log)
Prints a non-announcement message to a given log, with a certain verbosity. |
void |
println(java.lang.String s,
int _verbosity,
int log)
Prints a non-announcement message to the given logs, with a certain verbosity. |
void |
println(java.lang.String s,
int _verbosity,
int[] _logs)
Prints a non-announcement message to the given logs, with a certain verbosity. |
void |
println(java.lang.String s,
int _verbosity,
int log,
boolean _announcement)
Prints a message to a given log, with a certain verbosity. |
protected void |
println(java.lang.String s,
int _verbosity,
Log log,
boolean _announcement,
boolean _reposting)
Prints a message to a given log, with a certain verbosity. |
Log |
removeLog(int x)
Removes the given log. |
void |
reopen(int _log)
Forces a file-based log to reopen, erasing its previous contents. |
void |
reopen(int[] _logs)
Forces one or more file-based logs to reopen, erasing their previous contents. |
void |
restart()
|
boolean |
setFlush(boolean v)
Sets whether the Output flushes its announcements. |
int |
setGlobalVerbosity(int v)
Sets the global (static) verbosity of Output objects to v. |
int |
setVerbosity(int v)
Sets the Output object's general verbosity to v. |
void |
systemMessage(java.lang.String s)
Posts a system message. |
void |
warning(java.lang.String s)
Posts a warning. |
void |
warning(java.lang.String s,
Parameter p1)
Posts a warning. |
void |
warning(java.lang.String s,
Parameter p1,
Parameter p2)
Posts a warning. |
Methods inherited from class java.lang.Object |
clone,
equals,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Field Detail |
public static final int ALL_LOGS
public static final int V_VERBOSE
public static final int V_NO_MESSAGES
public static final int V_NO_WARNINGS
public static final int V_NO_GENERAL
public static final int V_NO_ERRORS
public static final int V_TOTALLY_SILENT
Constructor Detail |
public Output(boolean storeAnnouncementsInMemory, int verbosity)
Method Detail |
protected void finalize() throws java.lang.Throwable
public void flush()
public boolean setFlush(boolean v)
public int setVerbosity(int v)
public int getVerbosity()
public int setGlobalVerbosity(int v)
public int getGlobalVerbosity()
public int addLog(java.io.File filename, int verbosity, boolean postAnnouncements, boolean appendOnRestart) throws java.io.IOException
public int addLog(int descriptor, int verbosity, boolean postAnnouncements)
public int addLog(java.io.Writer writer, LogRestarter restarter, int verbosity, boolean postAnnouncements, boolean repostAnnouncements)
public int addLog(Log l)
public int numLogs()
public Log log(int x)
public Log removeLog(int x)
public static void initialError(java.lang.String s)
public static void initialError(java.lang.String s, Parameter p1)
public static void initialError(java.lang.String s, Parameter p1, Parameter p2)
public void systemMessage(java.lang.String s)
public void fatal(java.lang.String s)
public void fatal(java.lang.String s, Parameter p1)
public void fatal(java.lang.String s, Parameter p1, Parameter p2)
public void error(java.lang.String s)
public void error(java.lang.String s, Parameter p1)
public void error(java.lang.String s, Parameter p1, Parameter p2)
public void warning(java.lang.String s, Parameter p1, Parameter p2)
public void warning(java.lang.String s, Parameter p1)
public void warning(java.lang.String s)
public void message(java.lang.String s)
public void reopen(int _log) throws java.io.IOException
public void reopen(int[] _logs) throws java.io.IOException
protected void println(java.lang.String s, int _verbosity, Log log, boolean _announcement, boolean _reposting) throws OutputException
public void println(java.lang.String s, int _verbosity, int log, boolean _announcement) throws OutputException
public void println(java.lang.String s, int _verbosity, int[] _logs) throws OutputException
public void println(java.lang.String s, int _verbosity, int log) throws OutputException
protected void print(java.lang.String s, int _verbosity, Log log) throws OutputException
public void print(java.lang.String s, int _verbosity, int log) throws OutputException
public void print(java.lang.String s, int _verbosity, int[] _logs) throws OutputException
public void exitIfErrors()
public void clearErrors()
public void clearAnnouncements()
public void restart() throws java.io.IOException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |