Improve port forwarding logging

Summary: Port forwarding tool was logging the child process object. Made the logging cleaner and more useful.

Reviewed By: nikoant

Differential Revision: D31608867

fbshipit-source-id: 1c2ae7c926ed4e1b44d51db5415874600acde7ae
This commit is contained in:
Michel Weststrate
2021-10-14 03:16:38 -07:00
committed by Facebook GitHub Bot
parent f43ff73591
commit 6589eb86c5

View File

@@ -71,20 +71,26 @@ export class IOSDeviceManager {
(err, stdout, stderr) => {
// This happens on app reloads and doesn't need to be treated as an error.
console.warn(
'Port forwarding app failed to start',
'[conn] Port forwarding app failed to start',
err,
stdout,
stderr,
);
},
);
console.log('Port forwarding app started', childProcess);
console.info(
`[conn] Port forwarding app started (portForward: ${port}, multiplexChannelPort: ${multiplexChannelPort})`,
);
child.addListener('error', (err) =>
console.warn('Port forwarding app error', err),
);
child.addListener('exit', (code) =>
console.log(`Port forwarding app exited with code ${code}`),
console.warn('[conn] Port forwarding app error', err),
);
child.addListener('exit', (code) => {
if (code != 0) {
console.warn(`[conn] Port forwarding app exited with code ${code}`);
} else {
console.log(`[conn] Port forwarding app exited gracefully`);
}
});
return child;
}