mirror of
https://github.com/github/codeql.git
synced 2026-04-29 18:55:14 +02:00
C#: Introduce extractor option for logging verbosity
This commit is contained in:
@@ -20,6 +20,36 @@ namespace Semmle.Extraction
|
||||
/// </summary>
|
||||
public Verbosity LegacyVerbosity { get; protected set; } = Verbosity.Info;
|
||||
|
||||
private Verbosity? verbosity = null;
|
||||
public Verbosity Verbosity
|
||||
{
|
||||
get
|
||||
{
|
||||
if (verbosity != null)
|
||||
{
|
||||
return verbosity.Value;
|
||||
}
|
||||
|
||||
var envVarValue = EnvironmentVariables.GetExtractorOption("LOGGING_VERBOSITY");
|
||||
verbosity = VerbosityExtensions.ParseVerbosity(envVarValue, logThreadId: true);
|
||||
if (verbosity != null)
|
||||
{
|
||||
return verbosity.Value;
|
||||
}
|
||||
|
||||
envVarValue = Environment.GetEnvironmentVariable("CODEQL_VERBOSITY");
|
||||
verbosity = VerbosityExtensions.ParseVerbosity(envVarValue, logThreadId: true);
|
||||
if (verbosity != null)
|
||||
{
|
||||
return verbosity.Value;
|
||||
}
|
||||
|
||||
// This only works, because we already parsed the provided options, so `LegacyVerbosity` is already set (or it still has the default value).
|
||||
verbosity = LegacyVerbosity;
|
||||
return verbosity.Value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Whether to output to the console.
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user