Fix uncaught exception in adb logging
Summary:
Found some random unhandled rejection. Added error catching / logging to adb logcat setup.
{F558587842}
Reviewed By: passy
Differential Revision: D27429914
fbshipit-source-id: faca682819a2f1a3f924ee176cc9f8c9f92f5ae9
This commit is contained in:
committed by
Facebook GitHub Bot
parent
7e9346e736
commit
238374f4db
@@ -44,39 +44,48 @@ export default class AndroidDevice extends BaseDevice {
|
|||||||
}
|
}
|
||||||
|
|
||||||
startLogging() {
|
startLogging() {
|
||||||
this.adb.openLogcat(this.serial, {clear: true}).then((reader) => {
|
this.adb
|
||||||
this.reader = reader;
|
.openLogcat(this.serial, {clear: true})
|
||||||
reader.on('entry', (entry) => {
|
.then((reader) => {
|
||||||
let type: LogLevel = 'unknown';
|
this.reader = reader;
|
||||||
if (entry.priority === Priority.VERBOSE) {
|
reader
|
||||||
type = 'verbose';
|
.on('entry', (entry) => {
|
||||||
}
|
let type: LogLevel = 'unknown';
|
||||||
if (entry.priority === Priority.DEBUG) {
|
if (entry.priority === Priority.VERBOSE) {
|
||||||
type = 'debug';
|
type = 'verbose';
|
||||||
}
|
}
|
||||||
if (entry.priority === Priority.INFO) {
|
if (entry.priority === Priority.DEBUG) {
|
||||||
type = 'info';
|
type = 'debug';
|
||||||
}
|
}
|
||||||
if (entry.priority === Priority.WARN) {
|
if (entry.priority === Priority.INFO) {
|
||||||
type = 'warn';
|
type = 'info';
|
||||||
}
|
}
|
||||||
if (entry.priority === Priority.ERROR) {
|
if (entry.priority === Priority.WARN) {
|
||||||
type = 'error';
|
type = 'warn';
|
||||||
}
|
}
|
||||||
if (entry.priority === Priority.FATAL) {
|
if (entry.priority === Priority.ERROR) {
|
||||||
type = 'fatal';
|
type = 'error';
|
||||||
}
|
}
|
||||||
|
if (entry.priority === Priority.FATAL) {
|
||||||
|
type = 'fatal';
|
||||||
|
}
|
||||||
|
|
||||||
this.addLogEntry({
|
this.addLogEntry({
|
||||||
tag: entry.tag,
|
tag: entry.tag,
|
||||||
pid: entry.pid,
|
pid: entry.pid,
|
||||||
tid: entry.tid,
|
tid: entry.tid,
|
||||||
message: entry.message,
|
message: entry.message,
|
||||||
date: entry.date,
|
date: entry.date,
|
||||||
type,
|
type,
|
||||||
});
|
});
|
||||||
|
})
|
||||||
|
.on('error', (e) => {
|
||||||
|
console.warn('Failed to read from adb logcat: ', e);
|
||||||
|
});
|
||||||
|
})
|
||||||
|
.catch((e) => {
|
||||||
|
console.warn('Failed to open log stream: ', e);
|
||||||
});
|
});
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
stopLogging() {
|
stopLogging() {
|
||||||
|
|||||||
Reference in New Issue
Block a user