Log.d(TAG, "라인넘버를 넣어봅시다 " + Utils.lineOut());
1
2
3
4
5
6
|
public static String lineOut() {
int level = 3;
StackTraceElement[] traces;
traces = Thread.currentThread().getStackTrace();
return (" at " + traces[level] + " " );
}
|
함정이 있다면..
Log.d()함수를 다시 재수정 해서 Utils.lineOut()을 넣으려 해도 예를들면
1
2
3
|
public static void toLog(String str1, String str2) {
Log.d(str1,str2+Util.lineOut());//여기가 45라인이라 칩시다.
}
|
// 요렇게 해도 해당 toLog()를 콜한 지점이 아닌 toLog()함수 자체의 라인넘버인
// 45만 나옵니다. 해결법은 아직 찾지 못했습니다..아시는분 댓글 부탁드립니다~
댓글 없음:
댓글 쓰기