@@ -224,31 +224,17 @@ private static TagHead processTagAndHead(String tag) {
224224 } else {
225225 final StackTraceElement [] stackTrace = new Throwable ().getStackTrace ();
226226 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 )) {
243229 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 );
245231 }
246- if (sTagIsSpace ) tag = isSpace (tag ) ? className : tag ;
247232 if (sLogHeadSwitch ) {
248233 String tName = Thread .currentThread ().getName ();
249234 final String head = new Formatter ()
250- .format ("%s, %s(%s:%d)" ,
235+ .format ("%s, %s.%s (%s:%d)" ,
251236 tName ,
237+ targetElement .getClassName (),
252238 targetElement .getMethodName (),
253239 fileName ,
254240 targetElement .getLineNumber ())
@@ -265,10 +251,11 @@ private static TagHead processTagAndHead(String tag) {
265251 for (int i = 1 , len = consoleHead .length ; i < len ; ++i ) {
266252 targetElement = stackTrace [i + 3 ];
267253 consoleHead [i ] = new Formatter ()
268- .format ("%s%s(%s:%d)" ,
254+ .format ("%s%s.%s (%s:%d)" ,
269255 space ,
256+ targetElement .getClassName (),
270257 targetElement .getMethodName (),
271- targetElement . getFileName (),
258+ getFileName (targetElement ),
272259 targetElement .getLineNumber ())
273260 .toString ();
274261 }
@@ -279,6 +266,23 @@ private static TagHead processTagAndHead(String tag) {
279266 return new TagHead (tag , null , ": " );
280267 }
281268
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+
282286 private static String processBody (final int type , final Object ... contents ) {
283287 String body = NULL ;
284288 if (contents != null ) {
0 commit comments