Skip to content

Commit 57ffb02

Browse files
Move extra server logging to 'debug mode'
1 parent 82bc2a4 commit 57ffb02

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

src/omnisharp/server.ts

Lines changed: 13 additions & 4 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 {
@@ -448,7 +455,7 @@ export class OmniSharpServer {
448455
let listener: vscode.Disposable;
449456

450457
// Convert the timeout from the seconds to milliseconds, which is required by setTimeout().
451-
const timeoutDuration = this._options.projectLoadTimeout * 10000
458+
const timeoutDuration = this._options.projectLoadTimeout * 1000
452459

453460
// timeout logic
454461
const handle = setTimeout(() => {
@@ -551,7 +558,9 @@ export class OmniSharpServer {
551558
Arguments: request.data
552559
};
553560

554-
this._logger.appendLine(`Making request: ${request.command} (${id})`);
561+
if (this._debugMode) {
562+
this._logger.appendLine(`Making request: ${request.command} (${id})`);
563+
}
555564

556565
this._serverProcess.stdin.write(JSON.stringify(requestPacket) + '\n');
557566

@@ -564,7 +573,7 @@ export class OmniSharpServer {
564573
const output = `[${logLevel}:${name}] ${message}`;
565574

566575
// strip stuff like: /codecheck: 200 339ms
567-
if (!timing200Pattern.test(output)) {
576+
if (this._debugMode || !timing200Pattern.test(output)) {
568577
this._logger.appendLine(output);
569578
}
570579
}

0 commit comments

Comments
 (0)