Convert all connectivity logs from "log" to "info"
Summary: In a diff down the stack I introduced sending of info/warn/error logs to Scuba. Here I'm just changing level of all connectivity-related logging to "info" as they often required for investigations. Reviewed By: mweststrate Differential Revision: D31532770 fbshipit-source-id: 956d6712918291579b3beb12cb91ab69ce1e3859
This commit is contained in:
committed by
Facebook GitHub Bot
parent
64ce2e6f69
commit
1fae3a24c9
@@ -155,7 +155,7 @@ abstract class ServerAdapter {
|
||||
medium: number | undefined;
|
||||
} = rawData;
|
||||
|
||||
console.log(
|
||||
console.info(
|
||||
`[conn] Connection attempt: ${clientQuery.app} on ${clientQuery.device}, medium: ${message.medium}, cert: ${message.destination}`,
|
||||
clientQuery,
|
||||
);
|
||||
@@ -165,7 +165,7 @@ abstract class ServerAdapter {
|
||||
|
||||
const {csr, destination, medium} = message;
|
||||
|
||||
console.log(
|
||||
console.info(
|
||||
`[conn] Starting certificate exchange: ${clientQuery.app} on ${clientQuery.device}`,
|
||||
);
|
||||
try {
|
||||
@@ -176,7 +176,7 @@ abstract class ServerAdapter {
|
||||
transformCertificateExchangeMediumToType(medium),
|
||||
);
|
||||
|
||||
console.log(
|
||||
console.info(
|
||||
`[conn] Exchanged certificate: ${clientQuery.app} on ${result.deviceId}`,
|
||||
);
|
||||
const response = JSON.stringify({
|
||||
|
||||
@@ -125,12 +125,12 @@ class ServerController extends EventEmitter implements ServerEventsListener {
|
||||
this.initialized = this.certificateProvider
|
||||
.loadSecureServerConfig()
|
||||
.then((options) => {
|
||||
console.log('[conn] secure server listening at port: ', secure);
|
||||
console.info('[conn] secure server listening at port: ', secure);
|
||||
this.secureServer = createServer(secure, this, options);
|
||||
if (GK.get('flipper_websocket_server')) {
|
||||
const {secure: altSecure} =
|
||||
this.store.getState().application.altServerPorts;
|
||||
console.log(
|
||||
console.info(
|
||||
'[conn] secure server (ws) listening at port: ',
|
||||
altSecure,
|
||||
);
|
||||
@@ -143,12 +143,12 @@ class ServerController extends EventEmitter implements ServerEventsListener {
|
||||
}
|
||||
})
|
||||
.then(() => {
|
||||
console.log('[conn] insecure server listening at port: ', insecure);
|
||||
console.info('[conn] insecure server listening at port: ', insecure);
|
||||
this.insecureServer = createServer(insecure, this);
|
||||
if (GK.get('flipper_websocket_server')) {
|
||||
const {insecure: altInsecure} =
|
||||
this.store.getState().application.altServerPorts;
|
||||
console.log(
|
||||
console.info(
|
||||
'[conn] insecure server (ws) listening at port: ',
|
||||
altInsecure,
|
||||
);
|
||||
@@ -193,8 +193,9 @@ class ServerController extends EventEmitter implements ServerEventsListener {
|
||||
const {app, os, device, device_id, sdk_version, csr, csr_path, medium} =
|
||||
clientQuery;
|
||||
const transformedMedium = transformCertificateExchangeMediumToType(medium);
|
||||
console.log(
|
||||
console.info(
|
||||
`[conn] Connection established: ${app} on ${device_id}. Medium ${medium}. CSR: ${csr_path}`,
|
||||
clientQuery,
|
||||
);
|
||||
return this.addConnection(
|
||||
clientConnection,
|
||||
@@ -355,8 +356,10 @@ class ServerController extends EventEmitter implements ServerEventsListener {
|
||||
csr_path,
|
||||
csr,
|
||||
);
|
||||
console.log(
|
||||
console.info(
|
||||
`[conn] Detected ${app_name} on ${query.device_id} in certificate`,
|
||||
query,
|
||||
csrQuery,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -369,8 +372,10 @@ class ServerController extends EventEmitter implements ServerEventsListener {
|
||||
device: query.device,
|
||||
device_id: query.device_id,
|
||||
});
|
||||
console.log(
|
||||
console.info(
|
||||
`[conn] Matching device for ${query.app} on ${query.device_id}...`,
|
||||
query,
|
||||
csrQuery,
|
||||
);
|
||||
|
||||
const client: ClientDescription = {
|
||||
@@ -383,8 +388,10 @@ class ServerController extends EventEmitter implements ServerEventsListener {
|
||||
connection: connection,
|
||||
};
|
||||
|
||||
console.log(
|
||||
console.info(
|
||||
`[conn] Initializing client ${query.app} on ${query.device_id}...`,
|
||||
query,
|
||||
csrQuery,
|
||||
);
|
||||
|
||||
connection.subscribeToEvents((status: ConnectionStatus) => {
|
||||
@@ -396,7 +403,12 @@ class ServerController extends EventEmitter implements ServerEventsListener {
|
||||
}
|
||||
});
|
||||
|
||||
console.debug(`[conn] Device client initialized: ${id}.`, 'server');
|
||||
console.debug(
|
||||
`[conn] Device client initialized: ${id}.`,
|
||||
'server',
|
||||
query,
|
||||
csrQuery,
|
||||
);
|
||||
|
||||
/* If a device gets disconnected without being cleaned up properly,
|
||||
* Flipper won't be aware until it attempts to reconnect.
|
||||
@@ -436,8 +448,9 @@ class ServerController extends EventEmitter implements ServerEventsListener {
|
||||
removeConnection(id: string) {
|
||||
const info = this.connections.get(id);
|
||||
if (info) {
|
||||
console.log(
|
||||
console.info(
|
||||
`[conn] Disconnected: ${info.client.query.app} on ${info.client.query.device_id}.`,
|
||||
info.client.query,
|
||||
);
|
||||
this.flipperServer.emit('client-disconnected', {id});
|
||||
this.connections.delete(id);
|
||||
@@ -471,6 +484,7 @@ class ConnectionTracker {
|
||||
this.connectionProblemThreshold
|
||||
} times within ${this.timeWindowMillis / 1000}s.`,
|
||||
'server',
|
||||
client,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -112,7 +112,7 @@ class ServerRSocket extends ServerAdapter {
|
||||
|
||||
const clientQuery: SecureClientQuery = JSON.parse(payload.data);
|
||||
this.listener.onSecureConnectionAttempt(clientQuery);
|
||||
console.log(
|
||||
console.info(
|
||||
`[conn] Secure rsocket connection attempt: ${clientQuery.app} on ${clientQuery.device_id}. Medium ${clientQuery.medium}. CSR: ${clientQuery.csr_path}`,
|
||||
);
|
||||
|
||||
@@ -172,7 +172,7 @@ class ServerRSocket extends ServerAdapter {
|
||||
this.listener.onConnectionCreated(clientQuery, clientConnection);
|
||||
client
|
||||
.then((client) => {
|
||||
console.log(
|
||||
console.info(
|
||||
`[conn] Client created: ${clientQuery.app} on ${clientQuery.device_id}. Medium ${clientQuery.medium}. CSR: ${clientQuery.csr_path}`,
|
||||
);
|
||||
resolvedClient = client;
|
||||
|
||||
@@ -61,8 +61,9 @@ class ServerWebSocket extends ServerWebSocketBase {
|
||||
return;
|
||||
}
|
||||
|
||||
console.log(
|
||||
console.info(
|
||||
`[conn] Insecure websocket connection attempt: ${clientQuery.app} on ${clientQuery.device_id}.`,
|
||||
clientQuery,
|
||||
);
|
||||
this.listener.onConnectionAttempt(clientQuery);
|
||||
|
||||
@@ -92,8 +93,9 @@ class ServerWebSocket extends ServerWebSocketBase {
|
||||
ws.close();
|
||||
return;
|
||||
}
|
||||
console.log(
|
||||
console.info(
|
||||
`[conn] Secure websocket connection attempt: ${clientQuery.app} on ${clientQuery.device_id}. Medium ${clientQuery.medium}. CSR: ${clientQuery.csr_path}`,
|
||||
clientQuery,
|
||||
);
|
||||
this.listener.onSecureConnectionAttempt(clientQuery);
|
||||
|
||||
|
||||
@@ -66,7 +66,7 @@ class ServerWebSocketBrowser extends ServerWebSocketBase {
|
||||
os: 'MacOS', // TODO: not hardcoded! Use host device?
|
||||
};
|
||||
|
||||
console.log(
|
||||
console.info(
|
||||
`[conn] Local websocket connection attempt: ${clientQuery.app} on ${clientQuery.device_id}.`,
|
||||
);
|
||||
this.listener.onConnectionAttempt(clientQuery);
|
||||
@@ -108,7 +108,7 @@ class ServerWebSocketBrowser extends ServerWebSocketBase {
|
||||
const extendedClientQuery = {...clientQuery, medium: 3 as const};
|
||||
extendedClientQuery.sdk_version = plugins == null ? 4 : 1;
|
||||
|
||||
console.log(
|
||||
console.info(
|
||||
`[conn] Local websocket connection established: ${clientQuery.app} on ${clientQuery.device_id}.`,
|
||||
);
|
||||
|
||||
@@ -121,7 +121,7 @@ class ServerWebSocketBrowser extends ServerWebSocketBase {
|
||||
);
|
||||
client
|
||||
.then((client) => {
|
||||
console.log(
|
||||
console.info(
|
||||
`[conn] Client created: ${clientQuery.app} on ${clientQuery.device_id}.`,
|
||||
);
|
||||
resolvedClient = client;
|
||||
@@ -141,7 +141,7 @@ class ServerWebSocketBrowser extends ServerWebSocketBase {
|
||||
parsed = JSON.parse(m.toString());
|
||||
} catch (error) {
|
||||
// Throws a SyntaxError exception if the string to parse is not valid JSON.
|
||||
console.log('[conn] Received message is not valid.', error);
|
||||
console.info('[conn] Received message is not valid.', error);
|
||||
return;
|
||||
}
|
||||
// non-null payload id means response to prev request, it's handled in connection
|
||||
|
||||
@@ -152,11 +152,12 @@ export class IOSDeviceManager {
|
||||
.map((device) => device.serial),
|
||||
);
|
||||
|
||||
for (const {udid, type, name} of activeDevices) {
|
||||
for (const activeDevice of activeDevices) {
|
||||
const {udid, type, name} = activeDevice;
|
||||
if (currentDeviceIDs.has(udid)) {
|
||||
currentDeviceIDs.delete(udid);
|
||||
} else {
|
||||
console.log(`[conn] detected new iOS device ${udid}`);
|
||||
console.info(`[conn] detected new iOS device ${udid}`, activeDevice);
|
||||
const iOSDevice = new IOSDevice(
|
||||
this.flipperServer,
|
||||
this.iosBridge,
|
||||
@@ -169,7 +170,7 @@ export class IOSDeviceManager {
|
||||
}
|
||||
|
||||
currentDeviceIDs.forEach((id) => {
|
||||
console.log(`[conn] Could no longer find ${id}, removing...`);
|
||||
console.info(`[conn] Could no longer find ${id}, removing...`);
|
||||
this.flipperServer.unregisterDevice(id);
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user