public class LogUtils implements ILogUtilsModel{ private static final String Tag = "info"; public static boolean isOpen = false; private LogUtils() { throw new UnsupportedOperationException("cannot be instantiated"); } private static class SingletonLoader { private static final LogUtils INSTANCE = new LogUtils(); } public static LogUtils getInstance() { return SingletonLoader.INSTANCE; } @Override public void d(String msg) { if(isOpen) { Log.d(Tag, msg); } } @Override public void e(String msg) { if(isOpen) { Log.e(Tag, msg); } } @Override public void i(String msg) { if(isOpen) { Log.i(Tag, msg); } } }
LogUtils类统一管理log日志
最新推荐文章于 2024-05-15 09:36:12 发布