1
在我的應用程序的開發階段,對於我來說,獲取由Log.p()
和Log.e()
生成的所有日誌在一個字符串中(例如,在一個對話框中顯示它們,或者通過電子郵件發送一個不同於你的Log.sendLog()的方法)。Codename One - 獲取Log.p()和Log.e()生成的所有日誌的可靠方式
這就是爲什麼我創建了以下方法。我的問題是,如果它是可靠的,如果我沒有複製的東西已經存在:
/**
* Get all logs of the app generated with Log.p() or Log.e()
* @return All logs of the app generated with Log.p() or Log.e()
*/
public static String getAllLogs() {
String logs = "";
try {
logs = Util.readToString(Storage.getInstance().createInputStream("CN1Log__$"));
} catch (IOException ex) {
logs = "";
}
return logs;
}