Skip to content

Commit

Permalink
Make IPC debug tracing configurable
Browse files Browse the repository at this point in the history
This change associates IPC tracing with the logger.debug method,
therefore enabling debugging enables IPC tracing.

Additionally, two new scripts are added to the top package.json to
enable starting of the browser and electron application examples in
debug mode.

Signed-off-by: Alvaro Sanchez-Leon <[email protected]>
  • Loading branch information
alvsan09 committed Jun 17, 2021
1 parent c92e822 commit f3c546b
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion examples/electron/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
"bundle": "theia build --mode development",
"watch": "concurrently -n compile,bundle \"theiaext watch --preserveWatchOutput\" \"theia build --watch --mode development\"",
"start": "theia start --plugins=local-dir:../../plugins",
"start:debug": "yarn start --log-level=debug",
"start:debug": "yarn start --log-level=debug --remote-debugging-port=9222",
"test": "electron-mocha --timeout 60000 \"./lib/test/**/*.espec.js\""
},
"devDependencies": {
Expand Down
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@
"publish:check": "node scripts/check-publish.js",
"start:browser": "yarn rebuild:browser && yarn --cwd examples/browser start",
"start:electron": "yarn rebuild:electron && yarn --cwd examples/electron start",
"debug:browser": "yarn rebuild:browser && yarn --cwd examples/browser start:debug",
"debug:electron": "yarn rebuild:electron && yarn --cwd examples/electron start:debug",
"download:plugins": "theia download:plugins"
},
"workspaces": [
Expand Down
7 changes: 4 additions & 3 deletions packages/core/src/node/messaging/ipc-connection-provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,12 @@ export class IPCConnectionProvider {
error: (message: string) => this.logger.error(`[${options.serverName}: ${childProcess.pid}] ${message}`),
warn: (message: string) => this.logger.warn(`[${options.serverName}: ${childProcess.pid}] ${message}`),
info: (message: string) => this.logger.info(`[${options.serverName}: ${childProcess.pid}] ${message}`),
log: (message: string) => this.logger.info(`[${options.serverName}: ${childProcess.pid}] ${message}`)
log: (message: string) => this.logger.debug(`[${options.serverName}: ${childProcess.pid}] ${message}`)
});
connection.trace(Trace.Off, {
const traceValue = this.logger.isDebug() ? Trace.Verbose : Trace.Off;
connection.trace(traceValue, {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
log: (message: any, data?: string) => this.logger.info(`[${options.serverName}: ${childProcess.pid}] ${message}` + (typeof data === 'string' ? ' ' + data : ''))
log: (message: any, data?: string) => this.logger.debug(`[${options.serverName}: ${childProcess.pid}] ${message}` + (typeof data === 'string' ? ' ' + data : ''))
});
return connection;
}
Expand Down

0 comments on commit f3c546b

Please sign in to comment.