All Packages Class Hierarchy This Package Previous Next Index
Class com.andthehorseyourodeinon.utils.Logger
java.lang.Object
|
+----com.andthehorseyourodeinon.utils.Logger
- public class Logger
- extends Object
- implements Runnable
The Logger 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.
It's equivalent to the Messager class, but can be used statically.
- Version:
- $Id: Logger.java,v 1.1 2000/05/16 22:45:10 samuelg Exp $
-
BORE
-
-
ERROR
-
-
FATAL
-
-
INFORM
-
-
SILENT
-
-
WARN
-
-
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.
-
log(String)
- When output is enabled, writes a line to the console and, if a log file is
established, to the log file.
-
run()
- Activate this as a single logging thread that won't get garbage collected.
-
setDebugLevel(int)
- Sets the debug level output.
-
setFile()
- Sets logging to a unique file, closing any previous log files.
-
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
BORE
public static final short BORE
INFORM
public static final short INFORM
WARN
public static final short WARN
ERROR
public static final short ERROR
FATAL
public static final short FATAL
SILENT
public static final short SILENT
run
public void run()
- Activate this as a single logging thread that won't get garbage collected.
setFile
public static 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.
setFile
public static void setFile()
- Sets logging to a unique 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 static void close()
- Closes a log file.
silent
public static void silent()
- Disables output from this Messager
setDebugLevel
public static void setDebugLevel(int level)
- Sets the debug level output.
verbose
public static void verbose()
- Enables output from this Messager
toggleMode
public static void toggleMode()
- Toggles the output enable state of this Messager. If output was disabled,
this enables it, and vice versa.
debug
public static 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
log
public static void log(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