stomp.util
Class Log

java.lang.Object
  |
  +--stomp.util.Log

public class Log
extends java.lang.Object

Logs exceptions, important events, etc. By passing all of these messages through this class, developers can print messages to System.err when in a development environment, but to some kind of error log when in production, without having to change code in a million different files. In addition, information like the time of the error, the machine name, etc etc can be logged without the developer having to remember to write this code every time.

Author:
Eric Lindauer

Nested Class Summary
static interface Log.LogListener
           
 
Field Summary
static java.lang.String DEFAULT_CHANNEL
           
static java.lang.String USER_MESSAGE
           
 
Constructor Summary
Log()
           
 
Method Summary
static void addLogListener(Log.LogListener listener)
          adds a listener for log events to this object.
static void debug(java.lang.String message)
          acts like log ( String message ), except that the messages passed through this method are only of interest in a development environment
static void debug(java.lang.String channel, java.lang.String message)
           
static void exception(java.lang.String error)
           
static void exception(java.lang.String channel, java.lang.String error, java.lang.Throwable e)
           
static void exception(java.lang.String message, java.lang.Throwable e)
          logs the given exception and prints a stack trace of the error.
static void exception(java.lang.Throwable e)
           
static void log(java.lang.String message)
          logs the given event message.
static void log(java.lang.String channel, java.lang.String message)
           
static void main(java.lang.String[] args)
           
static void removeLogListener(Log.LogListener listener)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_CHANNEL

public static java.lang.String DEFAULT_CHANNEL

USER_MESSAGE

public static java.lang.String USER_MESSAGE
Constructor Detail

Log

public Log()
Method Detail

addLogListener

public static void addLogListener(Log.LogListener listener)
adds a listener for log events to this object.


removeLogListener

public static void removeLogListener(Log.LogListener listener)

exception

public static void exception(java.lang.String channel,
                             java.lang.String error,
                             java.lang.Throwable e)

exception

public static void exception(java.lang.String error)

exception

public static void exception(java.lang.Throwable e)

exception

public static void exception(java.lang.String message,
                             java.lang.Throwable e)
logs the given exception and prints a stack trace of the error. Note that the developer should still throw the exception after logging it!


log

public static void log(java.lang.String message)
logs the given event message. This indicates that everything is moving along all right, but that something is happening that someone might be interested in.


log

public static void log(java.lang.String channel,
                       java.lang.String message)

debug

public static void debug(java.lang.String message)
acts like log ( String message ), except that the messages passed through this method are only of interest in a development environment


debug

public static void debug(java.lang.String channel,
                         java.lang.String message)

main

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