public class LogUtils
{
private LogUtils()
{
/* cannot be instantiated */
throw new UnsupportedOperationException("cannot be instantiated");
}
public static boolean isDebug = true;// 是否需要打印bug,可以在application的onCreate函数里面初始化
private static final String TAG = "way";
private mCurrentLevel = 1;
private static final int VERBOSE = 1;
public static final int DEBUG = 2;
public static final int INFO = 3;
public static final int ERROR = 4;
// 下面四个是默认tag的函数
public static void v(String msg)
{
if (isDebug&&mCurrentLevel<=VERBOSE)
Log.v(TAG, msg);
}
public static void d(String msg)
{
if (isDebug&&mCurrentLevel<=DEBUG)
Log.d(TAG, msg);
}
public static void i(String msg)
{
if (isDebug&&mCurrentLevel<=INFO)
Log.i(TAG, msg);
}
public static void e(String msg)
{
if (isDebug$$mCurrentLevel<=ERROR)
Log.e(TAG, msg);
}
// 下面是传入自定义tag的函数
public static void i(String tag, String msg)
{
if (isDebug)
Log.i(tag, msg);
}
public static void d(String tag, String msg)
{
if (isDebug)
Log.i(tag, msg);
}
public static void e(String tag, String msg)
{
if (isDebug)
Log.i(tag, msg);
}
public static void v(String tag, String msg)
{
if (isDebug)
Log.i(tag, msg);
}
}
LogUtils工具栏
最新推荐文章于 2024-05-15 09:36:12 发布