edu.stanford.nlp.util.logging
Class PrettyLogger

java.lang.Object
  extended by edu.stanford.nlp.util.logging.PrettyLogger

public class PrettyLogger
extends Object

Primarily for debugging, PrettyLogger helps you dump various collection objects in a reasonably structured way via Redwood logging. It has support for many built in collection types (Mapping, Iterable, arrays, Properties) as well as anything that implements PrettyLoggable.

Author:
David McClosky, Gabor Angeli (+ primitive arrays; dictionaries)
See Also:
PrettyLoggable

Method Summary
static boolean dispatchable(Object obj)
          Returns true if an object has special logic for pretty logging (e.g.
static void log(Object obj)
          Pretty log an object.
static void log(Redwood.RedwoodChannels channels, Object obj)
          Pretty log an object.
static
<T> void
log(Redwood.RedwoodChannels channels, String description, Object obj)
          Pretty log an object.
static void log(String description, Object obj)
          Pretty log an object along with its description.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

log

public static void log(Object obj)
Pretty log an object. It will be logged to the default channel. Its class name will be used as a description.

Parameters:
obj - the object to be pretty logged

log

public static void log(String description,
                       Object obj)
Pretty log an object along with its description. It will be logged to the default channel.

Parameters:
description - denote the object in the logs (via a track name, etc.).
obj - the object to be pretty logged

log

public static void log(Redwood.RedwoodChannels channels,
                       Object obj)
Pretty log an object. Its class name will be used as a description.

Parameters:
channels - the channels to pretty log to
obj - the object to be pretty logged

log

public static <T> void log(Redwood.RedwoodChannels channels,
                           String description,
                           Object obj)
Pretty log an object.

Parameters:
channels - the channels to pretty log to
description - denote the object in the logs (via a track name, etc.).
obj - the object to be pretty logged

dispatchable

public static boolean dispatchable(Object obj)
Returns true if an object has special logic for pretty logging (e.g. implements PrettyLoggable). If so, we ask it to pretty log itself. If not, we can safely use its toString() in logs.

Parameters:
obj - The object to test
Returns:
true if the object is dispatchable


Stanford NLP Group