public static String generateAutoTag(int stackOffset){
  StackTraceElement[] currentStack=getCurrentStack();
  StackTraceElement element=currentStack[stackOffset];
  String className=element.getClassName();
  String pkgPath[]=className.split("\\.");
  if (pkgPath.length > 0) {
    className=pkgPath[pkgPath.length - 1];
  }
  StringBuilder sbInnerClass=new StringBuilder();
  int index;
  String strLoop=className;
  while ((index=strLoop.lastIndexOf("$")) != -1) {
    String piece=strLoop.substring(index + 1);
    sbInnerClass.insert(0,piece);
    if (!piece.matches("[0-9$]+")) {
      break;
    }
    sbInnerClass.insert(0,"$");
    strLoop=strLoop.substring(0,index);
  }
  if (sbInnerClass.length() > 0 && sbInnerClass.charAt(0) == '$') {
    sbInnerClass.deleteCharAt(0);
  }
  String innerClassName=sbInnerClass.toString();
  if (TextUtils.isDigitsOnly(innerClassName)) {
    innerClassName=null;
  }
  return TextUtils.isEmpty(innerClassName) ? className : innerClassName;
}

public static String generateAutoTag ( int stackOffset ) { StackTraceElement [ ] currentStack = getCurrentStack ( ) ; StackTraceElement element = currentStack [ stackOffset ] ; String className = element . getClassName ( ) ; String pkgPath [ ] = className . split ( "\\." ) ; if ( pkgPath . length > 0 ) { className = pkgPath [ pkgPath . length - 1 ] ; } StringBuilder sbInnerClass = new StringBuilder ( ) ; int index ; String strLoop = className ; while ( ( index = strLoop . lastIndexOf ( "$" ) ) != - 1 ) { String piece = strLoop . substring ( index + 1 ) ; sbInnerClass . insert ( 0 , piece ) ; if ( ! piece . matches ( "[0-9$]+" ) ) { break ; } sbInnerClass . insert ( 0 , "$" ) ; strLoop = strLoop . substring ( 0 , index ) ; } if ( sbInnerClass . length ( ) > 0 && sbInnerClass . charAt ( 0 ) == '$' ) { sbInnerClass . deleteCharAt ( 0 ) ; } String innerClassName = sbInnerClass . toString ( ) ; if ( TextUtils . isDigitsOnly ( innerClassName ) ) { innerClassName = null ; } return TextUtils . isEmpty ( innerClassName ) ? className : innerClassName ; }
generate auto tag for logs .
