@@ -224,31 +224,17 @@ private static TagHead processTagAndHead(String tag) {
224
224
} else {
225
225
final StackTraceElement [] stackTrace = new Throwable ().getStackTrace ();
226
226
StackTraceElement targetElement = stackTrace [3 ];
227
- String fileName = targetElement .getFileName ();
228
- String className ;
229
- // If name of file is null, should add
230
- // "-keepattributes SourceFile,LineNumberTable" in proguard file.
231
- if (fileName == null ) {
232
- className = targetElement .getClassName ();
233
- String [] classNameInfo = className .split ("\\ ." );
234
- if (classNameInfo .length > 0 ) {
235
- className = classNameInfo [classNameInfo .length - 1 ];
236
- }
237
- int index = className .indexOf ('$' );
238
- if (index != -1 ) {
239
- className = className .substring (0 , index );
240
- }
241
- fileName = className + ".java" ;
242
- } else {
227
+ final String fileName = getFileName (targetElement );
228
+ if (sTagIsSpace && isSpace (tag )) {
243
229
int index = fileName .indexOf ('.' );// Use proguard may not find '.'.
244
- className = index == -1 ? fileName : fileName .substring (0 , index );
230
+ tag = index == -1 ? fileName : fileName .substring (0 , index );
245
231
}
246
- if (sTagIsSpace ) tag = isSpace (tag ) ? className : tag ;
247
232
if (sLogHeadSwitch ) {
248
233
String tName = Thread .currentThread ().getName ();
249
234
final String head = new Formatter ()
250
- .format ("%s, %s(%s:%d)" ,
235
+ .format ("%s, %s.%s (%s:%d)" ,
251
236
tName ,
237
+ targetElement .getClassName (),
252
238
targetElement .getMethodName (),
253
239
fileName ,
254
240
targetElement .getLineNumber ())
@@ -265,10 +251,11 @@ private static TagHead processTagAndHead(String tag) {
265
251
for (int i = 1 , len = consoleHead .length ; i < len ; ++i ) {
266
252
targetElement = stackTrace [i + 3 ];
267
253
consoleHead [i ] = new Formatter ()
268
- .format ("%s%s(%s:%d)" ,
254
+ .format ("%s%s.%s (%s:%d)" ,
269
255
space ,
256
+ targetElement .getClassName (),
270
257
targetElement .getMethodName (),
271
- targetElement . getFileName (),
258
+ getFileName (targetElement ),
272
259
targetElement .getLineNumber ())
273
260
.toString ();
274
261
}
@@ -279,6 +266,23 @@ private static TagHead processTagAndHead(String tag) {
279
266
return new TagHead (tag , null , ": " );
280
267
}
281
268
269
+ private static String getFileName (final StackTraceElement targetElement ) {
270
+ String fileName = targetElement .getFileName ();
271
+ if (fileName != null ) return fileName ;
272
+ // If name of file is null, should add
273
+ // "-keepattributes SourceFile,LineNumberTable" in proguard file.
274
+ String className = targetElement .getClassName ();
275
+ String [] classNameInfo = className .split ("\\ ." );
276
+ if (classNameInfo .length > 0 ) {
277
+ className = classNameInfo [classNameInfo .length - 1 ];
278
+ }
279
+ int index = className .indexOf ('$' );
280
+ if (index != -1 ) {
281
+ className = className .substring (0 , index );
282
+ }
283
+ return className + ".java" ;
284
+ }
285
+
282
286
private static String processBody (final int type , final Object ... contents ) {
283
287
String body = NULL ;
284
288
if (contents != null ) {
0 commit comments