Skip to content

Commit 0a9f0d9

Browse files
Merge pull request #1169 from filipw/feature/993
Allow configuring any supported Omnisharp log level
2 parents 187a5a2 + 0ec1b46 commit 0a9f0d9

File tree

3 files changed

+17
-11
lines changed

3 files changed

+17
-11
lines changed

package.json

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -356,10 +356,14 @@
356356
},
357357
"omnisharp.loggingLevel": {
358358
"type": "string",
359-
"default": "default",
359+
"default": "information",
360360
"enum": [
361-
"default",
362-
"verbose"
361+
"trace",
362+
"debug",
363+
"information",
364+
"warning",
365+
"error",
366+
"critical"
363367
],
364368
"description": "Specifies the level of logging output from the OmniSharp server."
365369
},

src/omnisharp/options.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,12 @@ export class Options {
3333
? csharpConfig.get<boolean>('omnisharpUsesMono')
3434
: omnisharpConfig.get<boolean>('useMono');
3535

36-
const loggingLevel = omnisharpConfig.get<string>('loggingLevel');
36+
// support the legacy "verbose" level as "debug"
37+
let loggingLevel = omnisharpConfig.get<string>('loggingLevel');
38+
if (loggingLevel.toLowerCase() === 'verbose') {
39+
loggingLevel = 'debug';
40+
}
41+
3742
const autoStart = omnisharpConfig.get<boolean>('autoStart', true);
3843

3944
const projectLoadTimeout = omnisharpConfig.get<number>('projectLoadTimeout', 60);

src/omnisharp/server.ts

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -235,20 +235,17 @@ export class OmniSharpServer {
235235

236236
const solutionPath = launchTarget.target;
237237
const cwd = path.dirname(solutionPath);
238+
this._options = Options.Read();
239+
238240
let args = [
239241
'-s', solutionPath,
240242
'--hostPID', process.pid.toString(),
241243
'--stdio',
242244
'DotNet:enablePackageRestore=false',
243-
'--encoding', 'utf-8'
245+
'--encoding', 'utf-8',
246+
'--loglevel', this._options.loggingLevel
244247
];
245248

246-
this._options = Options.Read();
247-
248-
if (this._options.loggingLevel === 'verbose') {
249-
args.push('-v');
250-
}
251-
252249
this._logger.appendLine(`Starting OmniSharp server at ${new Date().toLocaleString()}`);
253250
this._logger.increaseIndent();
254251
this._logger.appendLine(`Target: ${solutionPath}`);

0 commit comments

Comments
 (0)