首先是定文件夹路径:
public static void init(Context context) {
logPath = Environment.getExternalStoragePublicDirectory("") + "/log/";
}
外部调用的相关日志存储方法:
private static final char VERBOSE = 'v';//手机运行日志信息
private static final char DEBUG = 'd';//调试信息日志
private static final char INFO = 'i';//系统运行期间系统状态日志
private static final char WARN = 'w';//业务执行失败且不影响下次业务信息日志
private static final char ERROR = 'e';//不可修复的错误日志
public static void v(String tag, String msg) {
writeToFile(VERBOSE, tag, msg);
}
public static void d(String tag, String msg) {
writeToFile(DEBUG, tag, msg);
}
public static void i(String tag, String msg) {
writeToFile(INFO, tag, msg);
}
public static void w(String tag, String msg)