public class LogHelper
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
private static java.lang.String |
SEP
Platform-specific line separator.
|
private static long |
startNanoTime
System.nanoTime() at program startup.
|
Modifier | Constructor and Description |
---|---|
private |
LogHelper()
Instances of this class cannot be created.
|
Modifier and Type | Method and Description |
---|---|
static void |
dumpStackTrace()
Takes the result of
getStackTrace() and sends it to the
standard output. |
static void |
dumpStackTrace(int entries)
Takes the result of
getStackTrace() and sends it to the
standard output. |
static void |
dumpStackTrace(java.lang.String message)
Takes the result of
getStackTrace() and sends it to the
standard error output stream together with the value of the only
argument. |
static void |
dumpStackTrace(java.lang.String message,
int entries)
Takes the result of
getStackTrace() and sends it to the
standard error output stream together with the value of the only
argument. |
static java.lang.String |
dumpThrowable(java.lang.Throwable t)
Dump all details of the throwable into a string.
|
static java.lang.StringBuilder |
dumpThrowable(java.lang.Throwable t,
java.lang.StringBuilder buf)
Dump all details of the throwable into the given buffer.
|
private static java.lang.String |
formatTrace(java.lang.String msg,
java.lang.Object... args)
Formats the input message and arguments for trace output.
|
static java.lang.String |
getStackTrace()
Returns a string representing the current call stack.
|
static java.lang.String |
getStackTrace(int entries)
Returns a string representing the current call stack.
|
private static java.lang.String |
getStackTraceImpl(int entries)
Returns a string representing the current call stack.
|
static void |
trace(int callstackEntries,
java.lang.String msg,
java.lang.Object... args)
The method formats
msg and args using
String.format(String, Object...) and outputs the result together with nano
time to the system error stream. |
static void |
trace(java.lang.String msg,
java.lang.Object... args)
The method formats
msg and args using
String.format(String, Object...) and outputs the result together with nano
time to the system error stream. |
private static final java.lang.String SEP
private static final long startNanoTime
public static java.lang.String dumpThrowable(java.lang.Throwable t)
t
- The throwable to dump.public static java.lang.StringBuilder dumpThrowable(java.lang.Throwable t, java.lang.StringBuilder buf)
t
- The throwable to dump.buf
- Buffer into which details are written.public static void dumpStackTrace()
getStackTrace()
and sends it to the
standard output.public static void dumpStackTrace(int entries)
getStackTrace()
and sends it to the
standard output.entries
- Number of stack entries to dump.public static void dumpStackTrace(java.lang.String message)
getStackTrace()
and sends it to the
standard error output stream together with the value of the only
argument.message
- A valid string or null
.public static void dumpStackTrace(java.lang.String message, int entries)
getStackTrace()
and sends it to the
standard error output stream together with the value of the only
argument.message
- A valid string or null
.entries
- Number of stack entries to dump.public static java.lang.String getStackTrace(int entries)
entries
- Number of stack entries to dump.public static java.lang.String getStackTrace()
private static java.lang.String getStackTraceImpl(int entries)
entries
- Number of stack entries to return, use negative number to get all.public static void trace(java.lang.String msg, java.lang.Object... args)
msg
and args
using
String.format(String, Object...)
and outputs the result together with nano
time to the system error stream.msg
- The message to output.args
- The arguments to format the message with.public static void trace(int callstackEntries, java.lang.String msg, java.lang.Object... args)
msg
and args
using
String.format(String, Object...)
and outputs the result together with nano
time to the system error stream. The method also outputs the current call stack with the
callstackEntries
number of entries.msg
- The message to output.args
- The arguments to format the message with.private static java.lang.String formatTrace(java.lang.String msg, java.lang.Object... args)
msg
- The message to output.args
- The arguments to format the message with.