Skip to content

Commit

Permalink
Merge pull request GitTools#576 from AdmiringWorm/AdmiringWorm/issue439
Browse files Browse the repository at this point in the history
(GitTools#439) Add option to disable warning to stderr
  • Loading branch information
gep13 committed Feb 12, 2024
2 parents a94d9d5 + 6d0b8c3 commit 80a02fc
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/GitReleaseManager.Cli/Logging/LogConfiguration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ private static void CreateConsoleFullLogger(LoggerConfiguration config, string c
.Filter.ByExcluding((logEvent) => !options.Verbose && logEvent.Level == LogEventLevel.Verbose)
.WriteTo.Console(
outputTemplate: consoleTemplate,
standardErrorFromLevel: LogEventLevel.Warning,
standardErrorFromLevel: options.IsCISystem ? LogEventLevel.Error : LogEventLevel.Warning,
theme: consoleTheme));
}

Expand Down
15 changes: 15 additions & 0 deletions src/GitReleaseManager.Core/Options/BaseSubOptions.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,21 @@
using System;
using CommandLine;

namespace GitReleaseManager.Core.Options
{
public abstract class BaseSubOptions
{
protected BaseSubOptions()
{
var ciEnvironmentVariable = Environment.GetEnvironmentVariable("CI");

bool isCiSystem;
if (!string.IsNullOrEmpty(ciEnvironmentVariable) && bool.TryParse(ciEnvironmentVariable, out isCiSystem))
{
IsCISystem = isCiSystem;
}
}

[Option("debug", HelpText = "Enable debugging console output")]
public bool Debug { get; set; }

Expand All @@ -18,5 +30,8 @@ public abstract class BaseSubOptions

[Option("verbose", HelpText = "Enable verbose console output")]
public bool Verbose { get; set; }

[Option("ci", HelpText = "Configure GitReleaseManager to be compatible with CI systems")]
public bool IsCISystem { get; set; }
}
}

0 comments on commit 80a02fc

Please sign in to comment.