All Packages Class Hierarchy This Package Previous Next Index
Class com.andthehorseyourodeinon.utils.Messager
java.lang.Object
|
+----com.andthehorseyourodeinon.utils.Messager
- public class Messager
- extends Object
The Messager class allows you to have a debug facility that nicely
labels the output with a timestamp, can write to a file, and that
can have the output turned on and off dynamically.
- Version:
- $Id: Messager.java,v 1.1 2000/05/16 22:45:10 samuelg Exp $
-
ERROR
-
-
FATAL
-
-
INFORM
-
-
WARN
-
-
Messager()
-
-
Messager(boolean)
- Constructor that specifies output mode.
-
Messager(String)
- Constructor that specifies a filename to write log to.
-
close()
- Closes a log file.
-
debug(int, String)
- When output is enabled, and the message level is equal to or greater than
the set debug level, writes a debug line to the console and, if a log file is
established, to the log file.
-
out(String)
- When output is enabled, writes a line to the console and, if a log file is
established, to the log file.
-
setDebugLevel(int)
- Sets the debug level output.
-
setFile(String)
- Sets logging to a file, closing any previous log files.
-
silent()
- Disables output from this Messager
-
toggleMode()
- Toggles the output enable state of this Messager.
-
verbose()
- Enables output from this Messager
INFORM
public static final short INFORM
WARN
public static final short WARN
ERROR
public static final short ERROR
FATAL
public static final short FATAL
Messager
public Messager()
Messager
public Messager(boolean isVerbose)
- Constructor that specifies output mode.
- Parameters:
- isVerbose - enables output when true, disables output when false.
Messager
public Messager(String theLogfile)
- Constructor that specifies a filename to write log to. This constructor
assumes output is enabled. Remember to call close if you log to a file!
- Parameters:
- theLogFile - filespec to write log to. File will be clobbered if it exists.
setFile
public void setFile(String logSpec)
- Sets logging to a file, closing any previous log files. Remember to call close if you log to a file!
- Parameters:
- logSpec - name of file to write log to.
close
public void close()
- Closes a log file.
silent
public void silent()
- Disables output from this Messager
setDebugLevel
public void setDebugLevel(int level)
- Sets the debug level output.
verbose
public void verbose()
- Enables output from this Messager
toggleMode
public void toggleMode()
- Toggles the output enable state of this Messager. If output was disabled,
this enables it, and vice versa.
debug
public void debug(int level,
String text)
- When output is enabled, and the message level is equal to or greater than
the set debug level, writes a debug line to the console and, if a log file is
established, to the log file. If output is disabled or the message level is
less than the debug level, the text is ignored.
- Parameters:
- level - the message level
- text - the line to output
out
public void out(String text)
- When output is enabled, writes a line to the console and, if a log file is
established, to the log file. If output is disabled, the text is ignored.
- Parameters:
- text - the line to output
All Packages Class Hierarchy This Package Previous Next Index