ALox  V. 2402 R. 0
Home ALox for C++ ALox for C# ALox for Java Download
Public Static Fields | Public Static Methods | Protected Static Fields | Protected Static Methods | List of all members
LogTools Class Referenceabstract
Collaboration diagram for LogTools:
[legend]

Class Description


Provides high level functionality for logging things like Exceptions or object instances.

Public Static Fields

static String fmtExcNull = "<No exception given>"
 
static String fmtExcStackTraceHeader = "Exception stack trace:"
 
static String fmtInstArrayPrefix = "array["
 
static String fmtInstArraySuffix = "]"
 
static String fmtInstCycRefPrefix = "(Cyclic ref., see line <"
 
static String fmtInstCycRefSuffix = ">)"
 
static String fmtInstIndent = " "
 
static String fmtInstIterablePrefix = "Iterable, size= "
 
static String fmtInstIterableSuffix = ""
 
static String fmtInstLineNoPrefix = "<"
 
static String fmtInstLineNoSuffix = ">"
 
static String FmtInstNoAccessToValue = "<no access>"
 
static String fmtInstNull = "<null>"
 
static String fmtInstRecursionLimit = "(MAX REC) "
 
static String fmtInstTypePrefix = "{"
 
static String fmtInstTypeSuffix = "}"
 
static int instTypeTabStop = 65
 
static int instValueTabStop = 35
 

Public Static Methods

static void exception (Exception e)
 
static void exception (Exception e, String headline)
 
static void exception (String domain, Verbosity verbosity, Exception e)
 
static void exception (String domain, Verbosity verbosity, Exception e, String headline)
 
static void exception (String domain, Verbosity verbosity, Exception e, String headline, Lox lox)
 
static void exception (Verbosity verbosity, Exception e)
 
static void exception (Verbosity verbosity, Exception e, String headline)
 
static void instance (String domain, Verbosity verbosity, Object o, int maxRecursion)
 
static void instance (String domain, Verbosity verbosity, Object o, int maxRecursion, String headline)
 
static void instance (String domain, Verbosity verbosity, Object o, int maxRecursion, String headline, Lox lox)
 
static void instance (Verbosity verbosity, Object o, int maxRecursion)
 
static void instance (Verbosity verbosity, Object o, int maxRecursion, String headline)
 
static void stackTrace (String domain, Verbosity verbosity)
 
static void stackTrace (String domain, Verbosity verbosity, String headline)
 
static void stackTrace (String domain, Verbosity verbosity, String headline, Lox lox)
 
static void stackTrace (Verbosity verbosity)
 
static void stackTrace (Verbosity verbosity, String headline)
 

Protected Static Fields

static ByteArrayOutputStream exceptionBAOS
 
static PrintStream exceptionPS = new PrintStream(exceptionBAOS= new ByteArrayOutputStream(8192))
 
static int instLineBeginIdx
 
static int instLineNumber
 
static HashMap< Object, Integer > instObject2LineNumber
 
static ThreadLock lock = new ThreadLock()
 
static AString tempBuf = new AString(512)
 
static int tempLineEndIdx
 
static int tempLineStartIdx
 
static AString toolBuf
 

Protected Static Methods

static void exc (Throwable e, String headline, int indent)
 
static void instBeginLine (int indent)
 
static void instMain (Object o, int maxRecursion, String headLine)
 
static void instNewLine ()
 
static void instRecursive (Object inst, int maxRecursion, int indent)
 
static void instTabStop (int tabStop)
 
static void instTabTypeAndNewLine ( @SuppressWarnings("rawtypes") Class type)
 
static boolean isWrapperType (Object o)
 
static void nextTempBufLine ()
 

Member Function Documentation

◆ exc()

static void exc ( Throwable  e,
String  headline,
int  indent 
)
staticprotected

Logs an exception.

Parameters
eThe exception to be logged.
headlineA headline string to precede the exception with.
indentThe indentation in the output (recursively increased). If set to -1 the 'headline' is logged.

◆ exception() [1/7]

static void exception ( Exception  e)
static

Log an exception including inner exceptions recursively.

Parameters
eThe Exception to log.

◆ exception() [2/7]

static void exception ( Exception  e,
String  headline 
)
static

Log an exception including inner exceptions recursively.

Parameters
eThe Exception to log.
headline(Optional) A headline string preceding the exception output.

◆ exception() [3/7]

static void exception ( String  domain,
Verbosity  verbosity,
Exception  e 
)
static

Log an exception including inner exceptions recursively.

Parameters
domainThe Log Domain which is combined with Scope Domains set for the Scope of invocation.
verbosityThe verbosity.
eThe Exception to log.

◆ exception() [4/7]

static void exception ( String  domain,
Verbosity  verbosity,
Exception  e,
String  headline 
)
static

Log an exception including inner exceptions recursively.

Parameters
domainThe Log Domain which is combined with Scope Domains set for the Scope of invocation.
verbosityThe verbosity.
eThe Exception to log.
headline(Optional) A headline string preceding the exception output.

◆ exception() [5/7]

static void exception ( String  domain,
Verbosity  verbosity,
Exception  e,
String  headline,
Lox  lox 
)
static

Log an exception including inner exceptions recursively.

Parameters
domainThe Log Domain which is combined with Scope Domains set for the Scope of invocation.
verbosityThe verbosity.
eThe Exception to log.
headline(Optional) A headline string preceding the exception output.
lox(Optional) The Lox to log with. If null, the static member LOX of class Log is used.

◆ exception() [6/7]

static void exception ( Verbosity  verbosity,
Exception  e 
)
static

Log an exception including inner exceptions recursively.

Parameters
verbosityThe verbosity.
eThe Exception to log.

◆ exception() [7/7]

static void exception ( Verbosity  verbosity,
Exception  e,
String  headline 
)
static

Log an exception including inner exceptions recursively.

Parameters
verbosityThe verbosity.
eThe Exception to log.
headline(Optional) A headline string preceding the exception output.

◆ instance() [1/5]

static void instance ( String  domain,
Verbosity  verbosity,
Object  o,
int  maxRecursion 
)
static

Recursively logs objects using reflection.

Parameters
domainThe Log Domain which is combined with Scope Domains set for the Scope of invocation.
verbosityThe verbosity.
oThe object to be logged.
maxRecursionThe maximum depth of recursion for logging nested object.

◆ instance() [2/5]

static void instance ( String  domain,
Verbosity  verbosity,
Object  o,
int  maxRecursion,
String  headline 
)
static

Recursively logs objects using reflection.

Parameters
domainThe Log Domain which is combined with Scope Domains set for the Scope of invocation.
verbosityThe verbosity.
oThe object to be logged.
maxRecursionThe maximum depth of recursion for logging nested object.
headline(Optional) A headline string to precede the exception with.

◆ instance() [3/5]

static void instance ( String  domain,
Verbosity  verbosity,
Object  o,
int  maxRecursion,
String  headline,
Lox  lox 
)
static

Recursively logs objects using reflection.

Parameters
domainThe Log Domain which is combined with Scope Domains set for the Scope of invocation.
verbosityThe verbosity.
oThe object to be logged.
maxRecursionThe maximum depth of recursion for logging nested object.
headline(Optional) A headline string to precede the exception with.
lox(Optional) The lox to log with. If null, the static member LOX of the static class Log is used.

◆ instance() [4/5]

static void instance ( Verbosity  verbosity,
Object  o,
int  maxRecursion 
)
static

Recursively logs objects using reflection.

Parameters
verbosityThe verbosity.
oThe object to be logged.
maxRecursionThe maximum depth of recursion for logging nested object.

◆ instance() [5/5]

static void instance ( Verbosity  verbosity,
Object  o,
int  maxRecursion,
String  headline 
)
static

Recursively logs objects using reflection.

Parameters
verbosityThe verbosity.
oThe object to be logged.
maxRecursionThe maximum depth of recursion for logging nested object.
headline(Optional) A headline string to precede the exception with.

◆ instBeginLine()

static void instBeginLine ( int  indent)
staticprotected

Appends line number (format defined in fields fmtInstLineNoPrefix and fmtInstLineNoSuffix) and then adds indent characters (defined in field fmtInstIndent).

Parameters
indentThe indentation of the line.

◆ instMain()

static void instMain ( Object  o,
int  maxRecursion,
String  headLine 
)
staticprotected

Logs the header and invokes instRecursive().

Parameters
oThe object to be logged.
maxRecursionThe maximum depth of recursion for logging nested object.
headLineThe headline to log.

◆ instNewLine()

static void instNewLine ( )
staticprotected

Adds a new line to the buffer and increases line number counter.

◆ instRecursive()

static void instRecursive ( Object  inst,
int  maxRecursion,
int  indent 
)
staticprotected

Recursively log an instance using reflection.

Parameters
instThe element.
maxRecursionThe maximum depth of recursion for logging nested object.
indentThe indentation in the output (recursively increased).

◆ instTabStop()

static void instTabStop ( int  tabStop)
staticprotected

Appends spaces to move to the given tabStop (but at least one).

Parameters
tabStopThe tab stop position to go to.

◆ instTabTypeAndNewLine()

static void instTabTypeAndNewLine ( @SuppressWarnings("rawtypes") Class  type)
staticprotected

Appends type information at the end of the line and starts a new line.

Parameters
typeThe class to append in the log.

◆ isWrapperType()

static boolean isWrapperType ( Object  o)
staticprotected

Tests if an object is a primitive wrapper type.

Parameters
oThe object to check
Returns
true, if object is a wrapper type

◆ nextTempBufLine()

static void nextTempBufLine ( )
staticprotected

Finds the next line in tempBuf and stores start and end index in tempLineStartIdx and tempLineEndIdx.

◆ stackTrace() [1/5]

static void stackTrace ( String  domain,
Verbosity  verbosity 
)
static

Log the current stack trace.

Parameters
domainThe Log Domain which is combined with Scope Domains set for the Scope of invocation.
verbosityThe verbosity.

◆ stackTrace() [2/5]

static void stackTrace ( String  domain,
Verbosity  verbosity,
String  headline 
)
static

Log the current stack trace.

Parameters
domainThe Log Domain which is combined with Scope Domains set for the Scope of invocation.
verbosityThe verbosity.
headline(Optional) A headline string preceding the stacktrace output.

◆ stackTrace() [3/5]

static void stackTrace ( String  domain,
Verbosity  verbosity,
String  headline,
Lox  lox 
)
static

Log the current stack trace.

Parameters
domainThe Log Domain which is combined with Scope Domains set for the Scope of invocation.
verbosityThe verbosity.
headline(Optional) A headline string preceding the stack trace output.
lox(Optional) The Lox to log with. If null, the static member LOX of class Log is used.

◆ stackTrace() [4/5]

static void stackTrace ( Verbosity  verbosity)
static

Log the current stack trace.

Parameters
verbosityThe verbosity.

◆ stackTrace() [5/5]

static void stackTrace ( Verbosity  verbosity,
String  headline 
)
static

Log the current stack trace.

Parameters
verbosityThe verbosity.
headline(Optional) A headline string preceding the stacktrace output.

Member Data Documentation

◆ exceptionBAOS

ByteArrayOutputStream exceptionBAOS
staticprotected

Used for logging exceptions.

◆ exceptionPS

PrintStream exceptionPS = new PrintStream(exceptionBAOS= new ByteArrayOutputStream(8192))
staticprotected

Used for logging exceptions.

◆ fmtExcNull

String fmtExcNull = "<No exception given>"
static

The String to log out if the exception parameter equals null

◆ fmtExcStackTraceHeader

String fmtExcStackTraceHeader = "Exception stack trace:"
static

The String to log out prior to an exception stack trace

◆ fmtInstArrayPrefix

String fmtInstArrayPrefix = "array["
static

Prefix before logging size of an IEnumberable.

◆ fmtInstArraySuffix

String fmtInstArraySuffix = "]"
static

Suffix after logging IEnumberable.

◆ fmtInstCycRefPrefix

String fmtInstCycRefPrefix = "(Cyclic ref., see line <"
static

Prefix before logging out a cyclic reference line number.

◆ fmtInstCycRefSuffix

String fmtInstCycRefSuffix = ">)"
static

Suffix after logging out a cyclic reference line number.

◆ fmtInstIndent

String fmtInstIndent = " "
static

Indent String for instance lines

◆ fmtInstIterablePrefix

String fmtInstIterablePrefix = "Iterable, size= "
static

Prefix before logging size of an IEnumberable.

◆ fmtInstIterableSuffix

String fmtInstIterableSuffix = ""
static

Suffix after logging IEnumberable.

◆ fmtInstLineNoPrefix

String fmtInstLineNoPrefix = "<"
static

Prefix for instance line numbers

◆ fmtInstLineNoSuffix

String fmtInstLineNoSuffix = ">"
static

Suffix for instance line numbers

◆ FmtInstNoAccessToValue

String FmtInstNoAccessToValue = "<no access>"
static

String for non-accessible members

◆ fmtInstNull

String fmtInstNull = "<null>"
static

The String to log out if a given object instance equals null

◆ fmtInstRecursionLimit

String fmtInstRecursionLimit = "(MAX REC) "
static

Prefix before logging out a string representation of a member because recursion limit was reached.

◆ fmtInstTypePrefix

String fmtInstTypePrefix = "{"
static

Prefix for type names

◆ fmtInstTypeSuffix

String fmtInstTypeSuffix = "}"
static

Suffix for type names

◆ instLineBeginIdx

int instLineBeginIdx
staticprotected

Instance index of beginning of line in toolBuf.

◆ instLineNumber

int instLineNumber
staticprotected

Instance line number counter.

◆ instObject2LineNumber

HashMap<Object, Integer> instObject2LineNumber
staticprotected

Instance line number dictionary used to refer to already logged sub objects.

◆ instTypeTabStop

int instTypeTabStop = 65
static

Tab stop for types when logging instances.

◆ instValueTabStop

int instValueTabStop = 35
static

Tab stop for values when logging instances.

◆ lock

ThreadLock lock = new ThreadLock()
staticprotected

This is the ThreadLock (mutex) which each method of this class uses to lock resources, e.g. the toolBuf

◆ tempBuf

AString tempBuf = new AString(512)
staticprotected

Internal buffer for temporary operations

◆ tempLineEndIdx

int tempLineEndIdx
staticprotected

Pointer to end of current line in tempBuf, used by nextTempBufLine

◆ tempLineStartIdx

int tempLineStartIdx
staticprotected

Pointer to start of current line in tempBuf, used by nextTempBufLine

◆ toolBuf

AString toolBuf
staticprotected

Buffer to build log messages.


The documentation for this class was generated from the following file: