utilMDE
Class SimpleLog

Object
  extended by SimpleLog

public final class SimpleLog
extends Object

A logging class with the following features:


Field Summary
 boolean always_traceback
          Always provide a backtrace (traceback) when calling log.
 boolean enabled
          If false, do no output.
 String indent_str
          The current indentation string.
 String indent_str_one_level
          Indentation string for one level of indentation.
 boolean line_oriented
          True if every log call is made with a complete line of text.
 PrintStream logfile
          Where to write logging output.
 Stack<Long> start_times
           
 
Constructor Summary
SimpleLog()
           
SimpleLog(boolean enabled)
           
SimpleLog(boolean enabled, boolean always_traceback)
           
SimpleLog(String filename, boolean enabled)
           
 
Method Summary
 void clear()
          Clears indent and start times and then pushes one start time
 void clear(String format, Object... args)
          Calls clear() and then logs the specified message
 boolean enabled()
           
 void exdent_time(String format, Object... args)
          Prints the time and then exdents.
 void exdent()
           
 void exdent(String format, Object... args)
          Deprecated. Use separate calls to exdent() and log(String, Object...).
 void indent()
           
 void indent(String format, Object... args)
           
 void log_tb(String format, Object... args)
          Log a message, and provide a backtrace (traceback, or tb).
 void log_time(String format, Object... args)
          Writes the specified message and the elapsed time since the last call to start_time().
 void log(String format, Object... args)
          Log a message.
 void pop_start_time()
           
 void push_start_time()
          Push a new start time onto the stack.
 void reset_start_time()
          This overwrites the current start time; it does not push a new one!!
 void start_time()
          Deprecated. Use reset_start_time().
 void tb()
          Print a backtrace (traceback, or tb) to the log.
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

enabled

public boolean enabled
If false, do no output.


logfile

public PrintStream logfile
Where to write logging output.


indent_str

public String indent_str
The current indentation string.


indent_str_one_level

public String indent_str_one_level
Indentation string for one level of indentation.


always_traceback

public boolean always_traceback
Always provide a backtrace (traceback) when calling log.


line_oriented

public boolean line_oriented
True if every log call is made with a complete line of text. False if a log call may contain multiple lines, or if multiple log calls may be made, each with parts of a line; in this case, you must manage line delimiters yourself.


start_times

public Stack<Long> start_times
Constructor Detail

SimpleLog

public SimpleLog(boolean enabled,
                 boolean always_traceback)

SimpleLog

public SimpleLog(boolean enabled)

SimpleLog

public SimpleLog()

SimpleLog

public SimpleLog(String filename,
                 boolean enabled)
Method Detail

enabled

public final boolean enabled()

log

public final void log(String format,
                      Object... args)
Log a message. Provide a backtrace (traceback) if variable always_traceback is set.


log_tb

public final void log_tb(String format,
                         Object... args)
Log a message, and provide a backtrace (traceback, or tb).


tb

public final void tb()
Print a backtrace (traceback, or tb) to the log.


indent

public final void indent()

indent

public final void indent(String format,
                         Object... args)

clear

public final void clear()
Clears indent and start times and then pushes one start time


clear

public final void clear(String format,
                        Object... args)
Calls clear() and then logs the specified message


exdent

public final void exdent()

exdent

@Deprecated
public final void exdent(String format,
                                    Object... args)
Deprecated. Use separate calls to exdent() and log(String, Object...).

Extents and then prints. This is confusing.


exdent_time

public final void exdent_time(String format,
                              Object... args)
Prints the time and then exdents.


start_time

@Deprecated
public final void start_time()
Deprecated. Use reset_start_time().

This overwrites the current start time; it does not push a new one!!


reset_start_time

public final void reset_start_time()
This overwrites the current start time; it does not push a new one!!


push_start_time

public final void push_start_time()
Push a new start time onto the stack.


pop_start_time

public final void pop_start_time()

log_time

public final void log_time(String format,
                           Object... args)
Writes the specified message and the elapsed time since the last call to start_time(). Does not pop nor reset the current start time.