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 $

Variable Index

 o BORE
 o ERROR
 o FATAL
 o INFORM
 o SILENT
 o WARN

Method Index

 o close()
Closes a log file.
 o 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.
 o log(String)
When output is enabled, writes a line to the console and, if a log file is established, to the log file.
 o run()
Activate this as a single logging thread that won't get garbage collected.
 o setDebugLevel(int)
Sets the debug level output.
 o setFile()
Sets logging to a unique file, closing any previous log files.
 o setFile(String)
Sets logging to a file, closing any previous log files.
 o silent()
Disables output from this Messager
 o toggleMode()
Toggles the output enable state of this Messager.
 o verbose()
Enables output from this Messager

Variables

 o BORE
 public static final short BORE
 o INFORM
 public static final short INFORM
 o WARN
 public static final short WARN
 o ERROR
 public static final short ERROR
 o FATAL
 public static final short FATAL
 o SILENT
 public static final short SILENT

Methods

 o run
 public void run()
Activate this as a single logging thread that won't get garbage collected.

 o 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.
 o 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.
 o close
 public static void close()
Closes a log file.

 o silent
 public static void silent()
Disables output from this Messager

 o setDebugLevel
 public static void setDebugLevel(int level)
Sets the debug level output.

 o verbose
 public static void verbose()
Enables output from this Messager

 o toggleMode
 public static void toggleMode()
Toggles the output enable state of this Messager. If output was disabled, this enables it, and vice versa.

 o 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
 o 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