clean up console
Summary: The console was pretty spammy. This fixes some issues that were logged and changes many log statements to `console.debug` which are not shown by default. Reviewed By: passy Differential Revision: D9303011 fbshipit-source-id: 1102f4f8814152a45f155cb43488a515c2d4eee4
This commit is contained in:
committed by
Facebook Github Bot
parent
eb316be4e4
commit
6f2a7dcb05
@@ -138,7 +138,7 @@ export default class Client extends EventEmitter {
|
|||||||
error?: Object,
|
error?: Object,
|
||||||
|} = rawData;
|
|} = rawData;
|
||||||
|
|
||||||
console.log(data, 'message:receive');
|
console.debug(data, 'message:receive');
|
||||||
|
|
||||||
const {id, method} = data;
|
const {id, method} = data;
|
||||||
|
|
||||||
@@ -240,7 +240,7 @@ export default class Client extends EventEmitter {
|
|||||||
params,
|
params,
|
||||||
};
|
};
|
||||||
|
|
||||||
console.log(data, 'message:call');
|
console.debug(data, 'message:call');
|
||||||
this.startTimingRequestResponse({method, id, params});
|
this.startTimingRequestResponse({method, id, params});
|
||||||
this.connection.fireAndForget({data: JSON.stringify(data)});
|
this.connection.fireAndForget({data: JSON.stringify(data)});
|
||||||
});
|
});
|
||||||
@@ -273,7 +273,7 @@ export default class Client extends EventEmitter {
|
|||||||
method,
|
method,
|
||||||
params,
|
params,
|
||||||
};
|
};
|
||||||
console.log(data, 'message:send');
|
console.debug(data, 'message:send');
|
||||||
this.connection.fireAndForget({data: JSON.stringify(data)});
|
this.connection.fireAndForget({data: JSON.stringify(data)});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -103,10 +103,12 @@ export default class WelcomeScreen extends PureComponent<Props, State> {
|
|||||||
isMounted: false,
|
isMounted: false,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
timer: ?TimeoutID;
|
||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
// waiting sometime before showing the welcome screen to allow Flipper to
|
// waiting sometime before showing the welcome screen to allow Flipper to
|
||||||
// connect to devices, if there are any
|
// connect to devices, if there are any
|
||||||
setTimeout(
|
this.timer = setTimeout(
|
||||||
() =>
|
() =>
|
||||||
this.setState({
|
this.setState({
|
||||||
isMounted: true,
|
isMounted: true,
|
||||||
@@ -115,6 +117,12 @@ export default class WelcomeScreen extends PureComponent<Props, State> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
componentWillUnmount() {
|
||||||
|
if (this.timer) {
|
||||||
|
clearTimeout(this.timer);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
return (
|
return (
|
||||||
<Container>
|
<Container>
|
||||||
|
|||||||
@@ -244,6 +244,9 @@ export default class LogTable extends SonarDevicePlugin<LogsState> {
|
|||||||
static icon = 'arrow-right';
|
static icon = 'arrow-right';
|
||||||
static keyboardActions = ['clear', 'goToBottom', 'createPaste'];
|
static keyboardActions = ['clear', 'goToBottom', 'createPaste'];
|
||||||
|
|
||||||
|
initTimer: ?TimeoutID;
|
||||||
|
batchTimer: ?TimeoutID;
|
||||||
|
|
||||||
onKeyboardAction = (action: string) => {
|
onKeyboardAction = (action: string) => {
|
||||||
if (action === 'clear') {
|
if (action === 'clear') {
|
||||||
this.clearLogs();
|
this.clearLogs();
|
||||||
@@ -384,7 +387,7 @@ export default class LogTable extends SonarDevicePlugin<LogsState> {
|
|||||||
if (!queued) {
|
if (!queued) {
|
||||||
queued = true;
|
queued = true;
|
||||||
|
|
||||||
setTimeout(() => {
|
this.batchTimer = setTimeout(() => {
|
||||||
const thisBatch = batch;
|
const thisBatch = batch;
|
||||||
batch = [];
|
batch = [];
|
||||||
queued = false;
|
queued = false;
|
||||||
@@ -421,13 +424,22 @@ export default class LogTable extends SonarDevicePlugin<LogsState> {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
setTimeout(() => {
|
this.initTimer = setTimeout(() => {
|
||||||
this.setState({
|
this.setState({
|
||||||
initialising: false,
|
initialising: false,
|
||||||
});
|
});
|
||||||
}, 2000);
|
}, 2000);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
componentWillUnmount() {
|
||||||
|
if (this.initTimer) {
|
||||||
|
clearTimeout(this.initTimer);
|
||||||
|
}
|
||||||
|
if (this.batchTimer) {
|
||||||
|
clearTimeout(this.batchTimer);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
addRowIfNeeded(
|
addRowIfNeeded(
|
||||||
rows: Array<TableBodyRow>,
|
rows: Array<TableBodyRow>,
|
||||||
row: TableBodyRow,
|
row: TableBodyRow,
|
||||||
|
|||||||
@@ -87,7 +87,7 @@ export default class Server extends EventEmitter {
|
|||||||
console.error(`Error opening server on port ${port}`, 'server');
|
console.error(`Error opening server on port ${port}`, 'server');
|
||||||
})
|
})
|
||||||
.on('listening', () => {
|
.on('listening', () => {
|
||||||
console.warn(
|
console.debug(
|
||||||
`${
|
`${
|
||||||
sslConfig ? 'Secure' : 'Certificate'
|
sslConfig ? 'Secure' : 'Certificate'
|
||||||
} server started on port ${port}`,
|
} server started on port ${port}`,
|
||||||
@@ -121,7 +121,7 @@ export default class Server extends EventEmitter {
|
|||||||
conn.connectionStatus().subscribe({
|
conn.connectionStatus().subscribe({
|
||||||
onNext(payload) {
|
onNext(payload) {
|
||||||
if (payload.kind == 'ERROR' || payload.kind == 'CLOSED') {
|
if (payload.kind == 'ERROR' || payload.kind == 'CLOSED') {
|
||||||
console.warn(`Device disconnected ${client.id}`, 'connection');
|
console.debug(`Device disconnected ${client.id}`, 'connection');
|
||||||
server.removeConnection(client.id);
|
server.removeConnection(client.id);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -175,7 +175,7 @@ export default class Server extends EventEmitter {
|
|||||||
destination: string,
|
destination: string,
|
||||||
|} = rawData;
|
|} = rawData;
|
||||||
if (json.method === 'signCertificate') {
|
if (json.method === 'signCertificate') {
|
||||||
console.warn('CSR received from device', 'server');
|
console.debug('CSR received from device', 'server');
|
||||||
const {csr, destination} = json;
|
const {csr, destination} = json;
|
||||||
return new Single(subscriber => {
|
return new Single(subscriber => {
|
||||||
subscriber.onSubscribe();
|
subscriber.onSubscribe();
|
||||||
@@ -217,7 +217,7 @@ export default class Server extends EventEmitter {
|
|||||||
destination: string,
|
destination: string,
|
||||||
|} = rawData;
|
|} = rawData;
|
||||||
if (json.method === 'signCertificate') {
|
if (json.method === 'signCertificate') {
|
||||||
console.warn('CSR received from device', 'server');
|
console.debug('CSR received from device', 'server');
|
||||||
const {csr, destination} = json;
|
const {csr, destination} = json;
|
||||||
this.certificateProvider
|
this.certificateProvider
|
||||||
.processCertificateSigningRequest(csr, clientData.os, destination)
|
.processCertificateSigningRequest(csr, clientData.os, destination)
|
||||||
@@ -242,7 +242,7 @@ export default class Server extends EventEmitter {
|
|||||||
invariant(query, 'expected query');
|
invariant(query, 'expected query');
|
||||||
|
|
||||||
const id = `${query.app}-${query.os}-${query.device}`;
|
const id = `${query.app}-${query.os}-${query.device}`;
|
||||||
console.warn(`Device connected: ${id}`, 'connection');
|
console.debug(`Device connected: ${id}`, 'connection');
|
||||||
|
|
||||||
const client = new Client(id, query, conn, this.logger);
|
const client = new Client(id, query, conn, this.logger);
|
||||||
|
|
||||||
@@ -252,7 +252,7 @@ export default class Server extends EventEmitter {
|
|||||||
};
|
};
|
||||||
|
|
||||||
client.init().then(() => {
|
client.init().then(() => {
|
||||||
console.log(
|
console.debug(
|
||||||
`Device client initialised: ${id}. Supported plugins: ${client.plugins.join(
|
`Device client initialised: ${id}. Supported plugins: ${client.plugins.join(
|
||||||
', ',
|
', ',
|
||||||
)}`,
|
)}`,
|
||||||
|
|||||||
@@ -125,7 +125,7 @@ export default class CertificateProvider {
|
|||||||
}
|
}
|
||||||
|
|
||||||
generateClientCertificate(csr: string): Promise<string> {
|
generateClientCertificate(csr: string): Promise<string> {
|
||||||
console.warn('Creating new client cert', logTag);
|
console.debug('Creating new client cert', logTag);
|
||||||
const csrFile = this.writeToTempFile(csr);
|
const csrFile = this.writeToTempFile(csr);
|
||||||
// Create a certificate for the client, using the details in the CSR.
|
// Create a certificate for the client, using the details in the CSR.
|
||||||
return openssl('x509', {
|
return openssl('x509', {
|
||||||
@@ -258,7 +258,7 @@ export default class CertificateProvider {
|
|||||||
filename: string,
|
filename: string,
|
||||||
contents: string,
|
contents: string,
|
||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
console.warn(`Deploying ${filename} to ${deviceId}:${app}`, logTag);
|
console.debug(`Deploying ${filename} to ${deviceId}:${app}`, logTag);
|
||||||
return this.executeCommandOnAndroid(
|
return this.executeCommandOnAndroid(
|
||||||
deviceId,
|
deviceId,
|
||||||
app,
|
app,
|
||||||
|
|||||||
@@ -16,6 +16,9 @@ const {exec} = require('child_process');
|
|||||||
const compilePlugins = require('./compilePlugins.js');
|
const compilePlugins = require('./compilePlugins.js');
|
||||||
const os = require('os');
|
const os = require('os');
|
||||||
|
|
||||||
|
// disable electron security warnings: https://github.com/electron/electron/blob/master/docs/tutorial/security.md#security-native-capabilities-and-your-responsibility
|
||||||
|
process.env.ELECTRON_DISABLE_SECURITY_WARNINGS = true;
|
||||||
|
|
||||||
if (!process.env.ANDROID_HOME) {
|
if (!process.env.ANDROID_HOME) {
|
||||||
process.env.ANDROID_HOME = '/opt/android_sdk';
|
process.env.ANDROID_HOME = '/opt/android_sdk';
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user