Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not force LogLevel.Debug for DEBUG builds #4739

Merged
merged 2 commits into from
May 30, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions src/kiota/Handlers/BaseKiotaCommandHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -136,9 +136,6 @@ protected async Task CheckForNewVersionAsync(ILogger logger, CancellationToken c
protected (ILoggerFactory, ILogger<T>) GetLoggerAndFactory<T>(InvocationContext context, string logFileRootPath = "")
{
LogLevel logLevel = context.ParseResult.GetValueForOption(LogLevelOption);
#if DEBUG
logLevel = logLevel > LogLevel.Debug ? LogLevel.Debug : logLevel;
#endif
var loggerFactory = LoggerFactory.Create(builder =>
{
var logFileAbsoluteRootPath = GetAbsolutePath(logFileRootPath);
Expand Down
7 changes: 6 additions & 1 deletion src/kiota/KiotaHost.cs
Original file line number Diff line number Diff line change
Expand Up @@ -541,7 +541,12 @@ internal static (Option<List<string>>, Option<List<string>>) GetIncludeAndExclud
}
internal static Option<LogLevel> GetLogLevelOption()
{
var logLevelOption = new Option<LogLevel>("--log-level", () => LogLevel.Warning, "The log level to use when logging messages to the main output.");
#if DEBUG
static LogLevel DefaultLogLevel() => LogLevel.Debug;
#else
static LogLevel DefaultLogLevel() => LogLevel.Warning;
#endif
var logLevelOption = new Option<LogLevel>("--log-level", DefaultLogLevel, "The log level to use when logging messages to the main output.");
logLevelOption.AddAlias("--ll");
AddEnumValidator(logLevelOption, "log level");
return logLevelOption;
Expand Down
Loading