赞
踩
Harmony开发中,其中自带的日志打印使用起来感觉真的是一言难尽,感觉挺麻烦的。
自带Log打印用法
public static final HiLogLabel TAGLABLE = new HiLogLabel(HiLog.LOG_APP, 0x00201, "MainAbilitySlice");
//使用
HiLog.error(TAGLABLE, "当前应用进程:" + this.getProcessInfo().getProcessName());
public class LogUtil {
private static final int DOMAIN = 0x10086;
private static final String TAG = "LogUtil";
private static final HiLogLabel LABEL = new HiLogLabel(HiLog.LOG_APP, DOMAIN, TAG);
public static void debug(String message) {
HiLog.debug(LABEL, message);
}
public static void info(String message) {
HiLog.info(LABEL, message);
}
public static void error(String message) {
HiLog.error(LABEL, message);
}
public static void LongLog(String msg) {
int maxLogLength = 1000;
for (int i = 0; i <= msg.length() / maxLogLength; i++) {
int start = i * maxLogLength;
int end = (i + 1) * maxLogLength;
end = Math.min(end, msg.length());
error(msg.substring(start, end));
}
}
}
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。