Last active
December 3, 2022 18:44
-
-
Save Faisal-FS/11a87f8c302c6ae472053c6f9f27b535 to your computer and use it in GitHub Desktop.
This is a reference code for the video "https://youtube.com/shorts/-swdK0vKcgM"
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class LogUtil { | |
| public static String getTag(){ | |
| StackTraceElement element = new Exception().getStackTrace()[1]; | |
| String tag = element.getClassName(); | |
| Matcher m = Pattern.compile("(\\$\\d+)+$").matcher(tag); | |
| if (m.find()) { | |
| tag = m.replaceAll(""); | |
| } | |
| return tag.substring(tag.lastIndexOf('.') + 1); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment