589 |
String message, |
String message, |
590 |
Object param) |
Object param) |
591 |
{ |
{ |
592 |
|
StackTraceElement caller = getCallerStackFrame(); |
593 |
logp(level, |
logp(level, |
594 |
/* sourceClass*/ null, |
caller.getClassName(), |
595 |
/* sourceMethod */ null, |
caller.getMethodName(), |
596 |
message, |
message, |
597 |
param); |
param); |
598 |
} |
} |
602 |
String message, |
String message, |
603 |
Object[] params) |
Object[] params) |
604 |
{ |
{ |
605 |
|
StackTraceElement caller = getCallerStackFrame(); |
606 |
logp(level, |
logp(level, |
607 |
/* sourceClass*/ null, |
caller.getClassName(), |
608 |
/* sourceMethod */ null, |
caller.getMethodName(), |
609 |
message, |
message, |
610 |
params); |
params); |
611 |
} |
} |
615 |
String message, |
String message, |
616 |
Throwable thrown) |
Throwable thrown) |
617 |
{ |
{ |
618 |
|
StackTraceElement caller = getCallerStackFrame(); |
619 |
logp(level, |
logp(level, |
620 |
/* sourceClass*/ null, |
caller.getClassName(), |
621 |
/* sourceMethod */ null, |
caller.getMethodName(), |
622 |
message, |
message, |
623 |
thrown); |
thrown); |
624 |
} |
} |
1167 |
|
|
1168 |
this.parent = parent; |
this.parent = parent; |
1169 |
} |
} |
1170 |
|
|
1171 |
|
/** |
1172 |
|
* Gets the StackTraceElement of the first class that is not this class. |
1173 |
|
* That should be the initial caller of a logging method. |
1174 |
|
* @return caller of the initial looging method |
1175 |
|
*/ |
1176 |
|
private StackTraceElement getCallerStackFrame() |
1177 |
|
{ |
1178 |
|
Throwable t = new Throwable(); |
1179 |
|
StackTraceElement[] stackTrace = t.getStackTrace(); |
1180 |
|
int index = 0; |
1181 |
|
// skip to stackentries until this class |
1182 |
|
while(!stackTrace[index].getClassName().equals(getClass().getName())){index++;} |
1183 |
|
// skip the stackentries of this class |
1184 |
|
while(stackTrace[index].getClassName().equals(getClass().getName())){index++;} |
1185 |
|
|
1186 |
|
return stackTrace[index]; |
1187 |
|
} |
1188 |
|
|
1189 |
} |
} |