Skip to content

Commit 9f429c9

Browse files
Move extra server logging to 'debug mode'
1 parent c547d9a commit 9f429c9

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

src/omnisharp/server.ts

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,8 @@ export class OmniSharpServer {
6060
private static _nextId = 1;
6161
private static StartupTimeout = 1000 * 60;
6262

63+
private _debugMode: boolean = false;
64+
6365
private _readLine: ReadLine;
6466
private _disposables: vscode.Disposable[] = [];
6567

@@ -84,7 +86,12 @@ export class OmniSharpServer {
8486

8587
this._channel = vscode.window.createOutputChannel('OmniSharp Log');
8688
this._logger = new Logger(message => this._channel.append(message));
87-
this._requestQueue = new RequestQueueCollection(this._logger, 8, request => this._makeRequest(request));
89+
90+
const logger = this._debugMode
91+
? this._logger
92+
: new Logger(message => { });
93+
94+
this._requestQueue = new RequestQueueCollection(logger, 8, request => this._makeRequest(request));
8895
}
8996

9097
public isRunning(): boolean {
@@ -549,7 +556,9 @@ export class OmniSharpServer {
549556
Arguments: request.data
550557
};
551558

552-
this._logger.appendLine(`Making request: ${request.command} (${id})`);
559+
if (this._debugMode) {
560+
this._logger.appendLine(`Making request: ${request.command} (${id})`);
561+
}
553562

554563
this._serverProcess.stdin.write(JSON.stringify(requestPacket) + '\n');
555564

@@ -562,7 +571,7 @@ export class OmniSharpServer {
562571
const output = `[${logLevel}:${name}] ${message}`;
563572

564573
// strip stuff like: /codecheck: 200 339ms
565-
if (!timing200Pattern.test(output)) {
574+
if (this._debugMode || !timing200Pattern.test(output)) {
566575
this._logger.appendLine(output);
567576
}
568577
}

0 commit comments

Comments
 (0)