org.incava.qualog
Class QlWriter

java.lang.Object
  extended by org.incava.qualog.QlWriter

public class QlWriter
extends java.lang.Object

Writes the logging output, applying filters and decorations. The Qualog class offers a much cleaner and more thorough interface than this class.

See Also:
Qualog

Field Summary
 java.util.List classesSkipped
           
 int classWidth
           
 boolean columns
           
 int fileWidth
           
 int functionWidth
           
 int lineWidth
           
 java.util.List methodsSkipped
           
static int NO_OUTPUT
           
 java.io.PrintWriter out
           
 java.util.List packagesSkipped
           
static int QUIET
           
 boolean showClasses
           
 boolean showFiles
           
static int VERBOSE
           
 
Constructor Summary
QlWriter()
           
 
Method Summary
 void addClassSkipped(java.lang.Class cls)
           
 void addClassSkipped(java.lang.String clsName)
           
 void addFilter(QlFilter filter)
          Adds a filter to be applied for output.
protected  void appendPadded(java.lang.StringBuffer buf, java.lang.String str, int maxSize)
           
 void clear()
          Resets parameters to their defaults.
 void clearClassColor(java.lang.String className)
           
 int findStackStart(java.lang.StackTraceElement[] stack)
          Returns the index in the stack where logging (stacks) should be displayed.
protected  java.lang.StackTraceElement[] getStack(int depth)
           
 boolean isLoggable(org.incava.qualog.QlLevel level)
           
 boolean isSkipped(java.lang.StackTraceElement ste)
           
protected  java.lang.String objectToString(java.lang.Object obj)
           
protected  void outputClassAndMethod(java.lang.StringBuffer buf, ANSIColor classColor, ANSIColor methodColor, java.lang.StackTraceElement stackElement)
           
protected  void outputFileName(java.lang.StringBuffer buf, ANSIColor fileColor, java.lang.StackTraceElement stackElement)
           
protected  void outputMessage(java.lang.StringBuffer buf, int framesShown, ANSIColor[] msgColor, java.lang.String msg, java.lang.StackTraceElement stackElement)
           
protected  java.lang.String repeat(int len, char ch)
           
protected  java.lang.StringBuffer repeat(java.lang.StringBuffer buf, int len, char ch)
           
 void reset()
           
 void set(boolean columns, int fileWidth, int lineWidth, int classWidth, int functionWidth)
           
 void setClassColor(java.lang.String className, ANSIColor color)
           
 void setColumns(boolean cols)
           
 void setDisabled(java.lang.Class cls)
           
 void setFileColor(java.lang.String fileName, ANSIColor color)
           
 void setMethodColor(java.lang.String className, java.lang.String methodName, ANSIColor color)
           
 void setOutput(int type, org.incava.qualog.QlLevel level)
          Sets the output type and level.
 void setPackageColor(java.lang.String pkg, ANSIColor color)
           
 boolean stack(org.incava.qualog.QlLevel lvl, ANSIColor[] msgColor, java.lang.String msg, ANSIColor fileColor, ANSIColor classColor, ANSIColor methodColor, int numFrames)
           
 boolean stack(org.incava.qualog.QlLevel level, ANSIColor[] msgColors, java.lang.String name, java.lang.Object obj, ANSIColor fileColor, ANSIColor classColor, ANSIColor methodColor, int numFrames)
           
 boolean verbose()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NO_OUTPUT

public static final int NO_OUTPUT
See Also:
Constant Field Values

QUIET

public static final int QUIET
See Also:
Constant Field Values

VERBOSE

public static final int VERBOSE
See Also:
Constant Field Values

fileWidth

public int fileWidth

columns

public boolean columns

lineWidth

public int lineWidth

functionWidth

public int functionWidth

classWidth

public int classWidth

showFiles

public boolean showFiles

showClasses

public boolean showClasses

out

public java.io.PrintWriter out

packagesSkipped

public java.util.List packagesSkipped

classesSkipped

public java.util.List classesSkipped

methodsSkipped

public java.util.List methodsSkipped
Constructor Detail

QlWriter

public QlWriter()
Method Detail

addFilter

public void addFilter(QlFilter filter)
Adds a filter to be applied for output.

See Also:
QlFilter

setDisabled

public void setDisabled(java.lang.Class cls)

setClassColor

public void setClassColor(java.lang.String className,
                          ANSIColor color)

setPackageColor

public void setPackageColor(java.lang.String pkg,
                            ANSIColor color)

setMethodColor

public void setMethodColor(java.lang.String className,
                           java.lang.String methodName,
                           ANSIColor color)

clearClassColor

public void clearClassColor(java.lang.String className)

setFileColor

public void setFileColor(java.lang.String fileName,
                         ANSIColor color)

set

public void set(boolean columns,
                int fileWidth,
                int lineWidth,
                int classWidth,
                int functionWidth)

setOutput

public void setOutput(int type,
                      org.incava.qualog.QlLevel level)
Sets the output type and level. Either verbose or quiet can be enabled.


verbose

public boolean verbose()

setColumns

public void setColumns(boolean cols)

addClassSkipped

public void addClassSkipped(java.lang.Class cls)

addClassSkipped

public void addClassSkipped(java.lang.String clsName)

clear

public void clear()
Resets parameters to their defaults.


reset

public void reset()

stack

public boolean stack(org.incava.qualog.QlLevel level,
                     ANSIColor[] msgColors,
                     java.lang.String name,
                     java.lang.Object obj,
                     ANSIColor fileColor,
                     ANSIColor classColor,
                     ANSIColor methodColor,
                     int numFrames)

isSkipped

public boolean isSkipped(java.lang.StackTraceElement ste)

isLoggable

public boolean isLoggable(org.incava.qualog.QlLevel level)

findStackStart

public int findStackStart(java.lang.StackTraceElement[] stack)
Returns the index in the stack where logging (stacks) should be displayed. Returns -1 if the end of the stack is reached and no logging should occur.


stack

public boolean stack(org.incava.qualog.QlLevel lvl,
                     ANSIColor[] msgColor,
                     java.lang.String msg,
                     ANSIColor fileColor,
                     ANSIColor classColor,
                     ANSIColor methodColor,
                     int numFrames)

outputFileName

protected void outputFileName(java.lang.StringBuffer buf,
                              ANSIColor fileColor,
                              java.lang.StackTraceElement stackElement)

outputClassAndMethod

protected void outputClassAndMethod(java.lang.StringBuffer buf,
                                    ANSIColor classColor,
                                    ANSIColor methodColor,
                                    java.lang.StackTraceElement stackElement)

outputMessage

protected void outputMessage(java.lang.StringBuffer buf,
                             int framesShown,
                             ANSIColor[] msgColor,
                             java.lang.String msg,
                             java.lang.StackTraceElement stackElement)

getStack

protected java.lang.StackTraceElement[] getStack(int depth)

repeat

protected java.lang.String repeat(int len,
                                  char ch)

repeat

protected java.lang.StringBuffer repeat(java.lang.StringBuffer buf,
                                        int len,
                                        char ch)

appendPadded

protected void appendPadded(java.lang.StringBuffer buf,
                            java.lang.String str,
                            int maxSize)

objectToString

protected java.lang.String objectToString(java.lang.Object obj)