Skip to content

Commit

Permalink
Merge pull request #1169 from filipw/feature/993
Browse files Browse the repository at this point in the history
Allow configuring any supported Omnisharp log level
  • Loading branch information
DustinCampbell authored Feb 3, 2017
2 parents 187a5a2 + 0ec1b46 commit 0a9f0d9
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 11 deletions.
10 changes: 7 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -356,10 +356,14 @@
},
"omnisharp.loggingLevel": {
"type": "string",
"default": "default",
"default": "information",
"enum": [
"default",
"verbose"
"trace",
"debug",
"information",
"warning",
"error",
"critical"
],
"description": "Specifies the level of logging output from the OmniSharp server."
},
Expand Down
7 changes: 6 additions & 1 deletion src/omnisharp/options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,12 @@ export class Options {
? csharpConfig.get<boolean>('omnisharpUsesMono')
: omnisharpConfig.get<boolean>('useMono');

const loggingLevel = omnisharpConfig.get<string>('loggingLevel');
// support the legacy "verbose" level as "debug"
let loggingLevel = omnisharpConfig.get<string>('loggingLevel');
if (loggingLevel.toLowerCase() === 'verbose') {
loggingLevel = 'debug';
}

const autoStart = omnisharpConfig.get<boolean>('autoStart', true);

const projectLoadTimeout = omnisharpConfig.get<number>('projectLoadTimeout', 60);
Expand Down
11 changes: 4 additions & 7 deletions src/omnisharp/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -235,20 +235,17 @@ export class OmniSharpServer {

const solutionPath = launchTarget.target;
const cwd = path.dirname(solutionPath);
this._options = Options.Read();

let args = [
'-s', solutionPath,
'--hostPID', process.pid.toString(),
'--stdio',
'DotNet:enablePackageRestore=false',
'--encoding', 'utf-8'
'--encoding', 'utf-8',
'--loglevel', this._options.loggingLevel
];

this._options = Options.Read();

if (this._options.loggingLevel === 'verbose') {
args.push('-v');
}

this._logger.appendLine(`Starting OmniSharp server at ${new Date().toLocaleString()}`);
this._logger.increaseIndent();
this._logger.appendLine(`Target: ${solutionPath}`);
Expand Down

0 comments on commit 0a9f0d9

Please sign in to comment.