edu.stanford.nlp.util.logging
Class Redwood.Util

java.lang.Object
  extended by edu.stanford.nlp.util.logging.Redwood.Util
Enclosing class:
Redwood

public static class Redwood.Util
extends Object

A utility class for Redwood intended for static import (import static edu.stanford.nlp.util.logging.Redwood.Util.*;), providing a wrapper for Redwood functions and adding utility shortcuts


Field Summary
static Color BLACK
           
static Style BLINK
           
static Color BLUE
           
static Style BOLD
           
static Style CROSS_OUT
           
static Color CYAN
           
static Redwood.Flag DBG
           
static Style DIM
           
static Redwood.Flag ERR
           
static Redwood.Flag FORCE
           
static Color GREEN
           
static Style ITALIC
           
static Color MAGENTA
           
static Color RED
           
static Redwood.Flag STDERR
           
static Redwood.Flag STDOUT
           
static Style UNDERLINE
           
static Redwood.Flag WARN
           
static Color WHITE
           
static Color YELLOW
           
 
Constructor Summary
Redwood.Util()
           
 
Method Summary
static void debug(Object... objs)
           
protected static void dontPrintChannels()
          Do not print a margin with the channels corresponding to a log entry.
static void end_track()
           
static void end_Track(String check)
           
static void endThreads(String check)
           
static void endTrack()
           
static void endTrack(String check)
           
static void err(Object... objs)
           
static void exit()
          Exits with status code 0, stopping Redwood first
static void exit(int exitCode)
          Exits with a given status code
static RuntimeException fail()
          Create a new RuntimeException with no arguments
static RuntimeException fail(Object msg)
          Create a RuntimeException with arguments
static void finishThread()
           
static void force_track(String title)
           
static void forceTrack(String title)
           
static void log(Object... objs)
           
static void logf(String format, Object... args)
           
static void prettyLog(Object obj)
           
static void prettyLog(String description, Object obj)
           
protected static void printChannels()
          Print (to console) a margin with the channels of a given log message.
static void printChannels(int width)
          Print (to console) a margin with the channels of a given log message.
static void println(Object o)
           
static void start_track(Object... objs)
           
static void startThreads(String title)
           
static void startTrack(Object... objs)
           
static ArrayList<Runnable> thread(Iterable<Runnable> runnables)
           
static ArrayList<Runnable> thread(String title, Iterable<Runnable> runnables)
          Wrap a collection of threads (Runnables) to be logged by Redwood.
static void threadAndRun(Iterable<Runnable> runnables)
           
static void threadAndRun(Iterable<Runnable> runnables, int numThreads)
           
static void threadAndRun(String title, Iterable<Runnable> runnables)
           
static void threadAndRun(String title, Iterable<Runnable> runnables, int numThreads)
          Thread a collection of runnables, and run them via a java Executor.
static void warn(Object... objs)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ERR

public static final Redwood.Flag ERR

WARN

public static final Redwood.Flag WARN

DBG

public static final Redwood.Flag DBG

FORCE

public static final Redwood.Flag FORCE

STDOUT

public static final Redwood.Flag STDOUT

STDERR

public static final Redwood.Flag STDERR

BOLD

public static Style BOLD

DIM

public static Style DIM

ITALIC

public static Style ITALIC

UNDERLINE

public static Style UNDERLINE

BLINK

public static Style BLINK

CROSS_OUT

public static Style CROSS_OUT

BLACK

public static Color BLACK

RED

public static Color RED

GREEN

public static Color GREEN

YELLOW

public static Color YELLOW

BLUE

public static Color BLUE

MAGENTA

public static Color MAGENTA

CYAN

public static Color CYAN

WHITE

public static Color WHITE
Constructor Detail

Redwood.Util

public Redwood.Util()
Method Detail

prettyLog

public static void prettyLog(Object obj)

prettyLog

public static void prettyLog(String description,
                             Object obj)

log

public static void log(Object... objs)

logf

public static void logf(String format,
                        Object... args)

warn

public static void warn(Object... objs)

debug

public static void debug(Object... objs)

err

public static void err(Object... objs)

println

public static void println(Object o)

exit

public static void exit(int exitCode)
Exits with a given status code


exit

public static void exit()
Exits with status code 0, stopping Redwood first


fail

public static RuntimeException fail(Object msg)
Create a RuntimeException with arguments


fail

public static RuntimeException fail()
Create a new RuntimeException with no arguments


startTrack

public static void startTrack(Object... objs)

start_track

public static void start_track(Object... objs)

forceTrack

public static void forceTrack(String title)

force_track

public static void force_track(String title)

endTrack

public static void endTrack(String check)

end_Track

public static void end_Track(String check)

endTrack

public static void endTrack()

end_track

public static void end_track()

startThreads

public static void startThreads(String title)

finishThread

public static void finishThread()

endThreads

public static void endThreads(String check)

thread

public static ArrayList<Runnable> thread(String title,
                                         Iterable<Runnable> runnables)
Wrap a collection of threads (Runnables) to be logged by Redwood. Each thread will be logged as a continuous chunk; concurrent threads will be queued and logged after the "main" thread has finished. This means that every Runnable passed to this method will run as a chunk, though in possibly random order. The handlers set up will operate on the output as if it were not concurrent -- timing will be preserved but repeated records will be collapsed as per the order the logs are actually output, rather than based on timestamp.

Parameters:
title - A title for the group of threads being run
runnables - The Runnables representing the tasks being run, without the Redwood overhead
Returns:
A new collection of Runnables with the Redwood overhead taken care of

thread

public static ArrayList<Runnable> thread(Iterable<Runnable> runnables)

threadAndRun

public static void threadAndRun(String title,
                                Iterable<Runnable> runnables,
                                int numThreads)
Thread a collection of runnables, and run them via a java Executor. This is a utility function; the Redwood-specific changes happen in the thread() method.

Parameters:
title - A title for the group of threads being run
runnables - The Runnables representing the tasks being run, without the Redwood overhead -- particularly, these should NOT have been passed to thread() yet.
numThreads - The number of threads to run on

threadAndRun

public static void threadAndRun(String title,
                                Iterable<Runnable> runnables)

threadAndRun

public static void threadAndRun(Iterable<Runnable> runnables,
                                int numThreads)

threadAndRun

public static void threadAndRun(Iterable<Runnable> runnables)

printChannels

public static void printChannels(int width)
Print (to console) a margin with the channels of a given log message. Note that this does not affect File printing.

Parameters:
width - The width of the margin to print (must be >2)

printChannels

protected static void printChannels()
Print (to console) a margin with the channels of a given log message. Note that this does not affect File printing.


dontPrintChannels

protected static void dontPrintChannels()
Do not print a margin with the channels corresponding to a log entry.



Stanford NLP Group