public class LogRecord
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
DEFAULT_TEXT_SPACING |
private int |
intDistanceFromLogRecordConstructorToTargetMethod |
private int |
intMethodBorderFlag |
private int |
intTargetLineNumber |
private int |
intTotalStackDepth |
private Level |
level |
private long |
lngTimeStampMillis |
static int |
METHOD_FLAG_COMMON |
static int |
METHOD_FLAG_ENDED |
static int |
METHOD_FLAG_START |
private java.lang.StackTraceElement |
ste
This thing stores a single group of meta information of the log record.
|
private java.lang.StackTraceElement[] |
ste1d
This thing stores all meta information of the log record.
|
private java.lang.String |
strMessage |
private java.lang.String |
strSourceClassName |
private java.lang.String |
strTargetClassName
"this.getClass().getName()" from the target class.
In some cases, the class name in stack trace element array does not match "this.getClass().getName()", so this name need to pass in manually. |
private java.lang.String |
strTargetFileName |
private java.lang.String |
strTargetMethodName |
private java.lang.String |
strTextSpacing |
private java.lang.Throwable |
tCaught |
Constructor and Description |
---|
LogRecord(Level level,
java.lang.String strTargetClassName,
java.lang.String strMessage,
int intDistanceFromLogRecordConstructorToTargetMethod,
java.lang.Throwable tCaught,
int intMethodBorderFlag) |
Modifier and Type | Method and Description |
---|---|
private java.lang.String |
dealMessage(java.util.ResourceBundle rb)
Deals the message with a resource bundle.
|
private java.lang.String |
generateTextSpan(int intTextSpanCount)
Generates the text span.
|
int |
getDistanceFromLogRecordConstructorToTargetMethod()
Gets the distance from log record constructor to target method.
|
java.lang.String |
getMessage()
Gets message.
|
Level |
getMesssagLevel()
Gets message level.
|
int |
getMethodBorderFlag()
Gets the flag of method border.
|
java.lang.String |
getSourceClassName()
Get the class name where this record TRUELY generated.
|
java.lang.String |
getTargetClassName()
Get "this.getClass().getName()" string of the target class.
In some cases, the class name in stack trace element array does not match "this.getClass().getName()", so this name need to pass in manually. |
java.lang.String |
getTargetFileName()
Gets the fFile name of target class.
|
int |
getTargetLineNumber()
Gets the line number of target file.
|
java.lang.String |
getTargetMethodName()
Gets the name of target method.
|
protected java.lang.String |
getTextSpacing()
Gets the text spacing.
|
java.lang.Throwable |
getThrowableCaught()
Gets the record throwable.
|
long |
getTimeStampMillis()
Gets time stamp milliseconds in long form.
|
int |
getTotalStackDepth()
Getting total stack depth.
|
private void |
parseStackTraceElements(java.lang.StackTraceElement[] ste1d)
Gets the 1d array of stack trace elements.
|
protected void |
resetTextSpacing()
Resets the text spacing to the default value.
|
protected void |
setTextSpacing(java.lang.String strTextSpacing)
Sets the text spacing.
|
java.lang.String |
toString()
Returns a string representation of the object.
|
java.lang.String |
toString(int intTextSpanCount)
Returns a string representation of the object.
|
java.lang.String |
toString(int intTextSpanDepth,
java.util.Locale locale)
Returns a string representation of the object.
|
java.lang.String |
toString(java.util.Locale locale)
Returns a string representation of the object.
|
public static final int METHOD_FLAG_COMMON
public static final int METHOD_FLAG_START
public static final int METHOD_FLAG_ENDED
public static final java.lang.String DEFAULT_TEXT_SPACING
private java.lang.String strTextSpacing
private Level level
private java.lang.String strMessage
private int intDistanceFromLogRecordConstructorToTargetMethod
private int intTotalStackDepth
private long lngTimeStampMillis
private java.lang.Throwable tCaught
private int intMethodBorderFlag
private java.lang.String strTargetClassName
private java.lang.String strSourceClassName
private java.lang.String strTargetMethodName
private java.lang.String strTargetFileName
private int intTargetLineNumber
private java.lang.StackTraceElement[] ste1d
private java.lang.StackTraceElement ste
public LogRecord(Level level, java.lang.String strTargetClassName, java.lang.String strMessage, int intDistanceFromLogRecordConstructorToTargetMethod, java.lang.Throwable tCaught, int intMethodBorderFlag)
level
- - Record level.strTargetClassName
- - "this.getClass().getName()" of the target class.strMessage
- - Record message.intDistanceFromLogRecordConstructorToTargetMethod
- - Distance of depth form [the target method who wants to
create a log record] to [the constructor of this log
record], so that the distance can be fixed.intMethodBorderFlag
- - An integer flag to indicates whether this log record is
generated at the border of a method.tCaught
- - Throwable to record.protected java.lang.String getTextSpacing()
protected void setTextSpacing(java.lang.String strTextSpacing)
strTextSpacing
- - The text spacing.protected void resetTextSpacing()
public Level getMesssagLevel()
public java.lang.String getMessage()
public int getDistanceFromLogRecordConstructorToTargetMethod()
public int getTotalStackDepth()
public long getTimeStampMillis()
public java.lang.Throwable getThrowableCaught()
public int getMethodBorderFlag()
public java.lang.String getTargetClassName()
public java.lang.String getSourceClassName()
public java.lang.String getTargetMethodName()
public java.lang.String getTargetFileName()
public int getTargetLineNumber()
private void parseStackTraceElements(java.lang.StackTraceElement[] ste1d)
ste1d
- - 1d array of stack trace elements.public java.lang.String toString()
toString
in class java.lang.Object
Object.toString()
public java.lang.String toString(int intTextSpanCount)
intTextSpanCount
- - Count of text span.public java.lang.String toString(java.util.Locale locale)
locale
- - Locale.public java.lang.String toString(int intTextSpanDepth, java.util.Locale locale)
intTextSpanDepth
- - Depth of text span.locale
- - Locale.private java.lang.String dealMessage(java.util.ResourceBundle rb)
rb
- - Resource bundle.private java.lang.String generateTextSpan(int intTextSpanCount)
intTextSpanCount
- - Count of text span.