public class Logger { /** * log tag */ private String tagName = "MoGuLogger";// tag name //private static int logLevel = Log.ERROR; private static int logLevel = Log.DEBUG; private static Logger inst; private Lock lock; private Logger() { lock = new ReentrantLock(); } public static synchronized Logger getLogger(Class<?> key) { if (inst == null) { inst = new Logger(); } return inst; } private String getFunctionName() { StackTraceElement[] sts = Thread.currentThread().getStackTrace(); if (sts == null) { return null; } for (StackTraceElement st : sts) { if (st.isNativeMethod()) { continue; } if (st.getClassName().equals(Thread.class.getName())) { continue; } if (st.getClassName().equals(this.getClass().getName())) { continue; }
版权声明:本文为Fzy99999原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。