Purple Code

com.purpletech.util
Class Logger

java.lang.Object
  |
  +--com.purpletech.util.Logger

public class Logger
extends java.lang.Object

Manages a list of log streams. By default, there are four log streams:
Log Target Purpose
err System.err Bad things the operator should know about
warn / warning System.err Bad things the operator may or may not want to know about
info / note System.out Informative status messages the operator may want to know about
debug null (disabled) Simple status messages to help you track the flow of control or data. Usually this is useless, so it's disabled by default.

When you call one of the log routines, it will print a line that contains the date, the name of the thread, the thread priority, and the message.

Usage: logger.err("invalid shoe size");


Field Summary
 boolean showThreadName
           
 boolean showThreadPriority
           
 
Constructor Summary
Logger()
           
 
Method Summary
 void debug(java.lang.Object msg)
           
 void disableLog(java.lang.String which)
           
 void err(java.lang.Object msg)
           
 java.io.PrintStream getLog(java.lang.String which)
           
 void info(java.lang.Object msg)
           
 void log(java.lang.String which, java.lang.Object msg)
          If msg is a String, it gets logged.
static void main(java.lang.String[] args)
           
 java.io.PrintStream makeStream(java.lang.String file)
          Make a PrintStream that prints to a file.
 void note(java.lang.Object msg)
           
protected  java.lang.String realname(java.lang.String which)
           
 void setLog(java.lang.String which, java.io.PrintStream out)
          Set the output stream for the given log type.
 void setLog(java.lang.String which, java.lang.String file)
           
 void warn(java.lang.Object msg)
           
 void warning(java.lang.Object msg)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

showThreadName

public boolean showThreadName

showThreadPriority

public boolean showThreadPriority
Constructor Detail

Logger

public Logger()
Method Detail

realname

protected java.lang.String realname(java.lang.String which)

getLog

public java.io.PrintStream getLog(java.lang.String which)

disableLog

public void disableLog(java.lang.String which)

setLog

public void setLog(java.lang.String which,
                   java.io.PrintStream out)
Set the output stream for the given log type. You can pass System.err or System.out, or a file name (which goes to the overloaded function), or any PrintStream


setLog

public void setLog(java.lang.String which,
                   java.lang.String file)

err

public void err(java.lang.Object msg)

warn

public void warn(java.lang.Object msg)

warning

public void warning(java.lang.Object msg)

info

public void info(java.lang.Object msg)

note

public void note(java.lang.Object msg)

debug

public void debug(java.lang.Object msg)

log

public void log(java.lang.String which,
                java.lang.Object msg)
If msg is a String, it gets logged. If msg is an Object, it gets converted to a String. If it's a Throwable, its stack trace gets printed to the stream (starting on the next line).


makeStream

public java.io.PrintStream makeStream(java.lang.String file)
Make a PrintStream that prints to a file. Suitable for passing to setLog().


main

public static void main(java.lang.String[] args)

Documentation generated March 5 2003