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 $

Variable Index

 o ERROR
 o FATAL
 o INFORM
 o WARN

Constructor Index

 o Messager()
 o Messager(boolean)
Constructor that specifies output mode.
 o Messager(String)
Constructor that specifies a filename to write log to.

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 out(String)
When output is enabled, writes a line to the console and, if a log file is established, to the log file.
 o setDebugLevel(int)
Sets the debug level output.
 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 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

Constructors

 o Messager
 public Messager()
 o Messager
 public Messager(boolean isVerbose)
Constructor that specifies output mode.

Parameters:
isVerbose - enables output when true, disables output when false.
 o 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.

Methods

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

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

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

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

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

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