org.incava.qualog

Class 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

static int
NO_OUTPUT
static int
QUIET
static int
VERBOSE
int
classWidth
List
classesSkipped
boolean
columns
int
fileWidth
int
functionWidth
int
lineWidth
List
methodsSkipped
PrintWriter
out
List
packagesSkipped
boolean
showClasses
boolean
showFiles

Method Summary

void
addClassSkipped(Class cls)
void
addClassSkipped(String clsName)
void
addFilter(QlFilter filter)
Adds a filter to be applied for output.
protected void
appendPadded(StringBuffer buf, String str, int maxSize)
void
clear()
Resets parameters to their defaults.
void
clearClassColor(String className)
int
findStackStart(StackTraceElement[] stack)
Returns the index in the stack where logging (stacks) should be displayed.
protected StackTraceElement[]
getStack(int depth)
boolean
isLoggable(QlLevel level)
boolean
isSkipped(StackTraceElement ste)
protected String
objectToString(Object obj)
protected void
outputClassAndMethod(StringBuffer buf, ANSIColor classColor, ANSIColor methodColor, StackTraceElement stackElement)
protected void
outputFileName(StringBuffer buf, ANSIColor fileColor, StackTraceElement stackElement)
protected void
outputMessage(StringBuffer buf, int framesShown, ANSIColor[] msgColor, String msg, StackTraceElement stackElement)
protected StringBuffer
repeat(StringBuffer buf, int len, char ch)
protected String
repeat(int len, char ch)
void
reset()
void
set(boolean columns, int fileWidth, int lineWidth, int classWidth, int functionWidth)
void
setClassColor(String className, ANSIColor color)
void
setColumns(boolean cols)
void
setDisabled(Class cls)
void
setFileColor(String fileName, ANSIColor color)
void
setMethodColor(String className, String methodName, ANSIColor color)
void
setOutput(int type, QlLevel level)
Sets the output type and level.
void
setPackageColor(String pkg, ANSIColor color)
boolean
stack(QlLevel level, ANSIColor[] msgColors, String name, Object obj, ANSIColor fileColor, ANSIColor classColor, ANSIColor methodColor, int numFrames)
boolean
stack(QlLevel lvl, ANSIColor[] msgColor, String msg, ANSIColor fileColor, ANSIColor classColor, ANSIColor methodColor, int numFrames)
boolean
verbose()

Field Details

NO_OUTPUT

public static final int NO_OUTPUT
Field Value:
0

QUIET

public static final int QUIET
Field Value:
1

VERBOSE

public static final int VERBOSE
Field Value:
2

classWidth

public int classWidth

classesSkipped

public List classesSkipped

columns

public boolean columns

fileWidth

public int fileWidth

functionWidth

public int functionWidth

lineWidth

public int lineWidth

methodsSkipped

public List methodsSkipped

out

public PrintWriter out

packagesSkipped

public List packagesSkipped

showClasses

public boolean showClasses

showFiles

public boolean showFiles

Method Details

addClassSkipped

public void addClassSkipped(Class cls)

addClassSkipped

public void addClassSkipped(String clsName)

addFilter

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

appendPadded

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

clear

public void clear()
Resets parameters to their defaults.

clearClassColor

public void clearClassColor(String className)

findStackStart

public int findStackStart(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.

getStack

protected StackTraceElement[] getStack(int depth)

isLoggable

public boolean isLoggable(QlLevel level)

isSkipped

public boolean isSkipped(StackTraceElement ste)

objectToString

protected String objectToString(Object obj)

outputClassAndMethod

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

outputFileName

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

outputMessage

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

repeat

protected StringBuffer repeat(StringBuffer buf,
                              int len,
                              char ch)

repeat

protected String repeat(int len,
                        char ch)

reset

public void reset()

set

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

setClassColor

public void setClassColor(String className,
                          ANSIColor color)

setColumns

public void setColumns(boolean cols)

setDisabled

public void setDisabled(Class cls)

setFileColor

public void setFileColor(String fileName,
                         ANSIColor color)

setMethodColor

public void setMethodColor(String className,
                           String methodName,
                           ANSIColor color)

setOutput

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

setPackageColor

public void setPackageColor(String pkg,
                            ANSIColor color)

stack

public boolean stack(QlLevel level,
                     ANSIColor[] msgColors,
                     String name,
                     Object obj,
                     ANSIColor fileColor,
                     ANSIColor classColor,
                     ANSIColor methodColor,
                     int numFrames)

stack

public boolean stack(QlLevel lvl,
                     ANSIColor[] msgColor,
                     String msg,
                     ANSIColor fileColor,
                     ANSIColor classColor,
                     ANSIColor methodColor,
                     int numFrames)

verbose

public boolean verbose()