diff --git a/DevProxy.Abstractions/Proxy/IProxyConfiguration.cs b/DevProxy.Abstractions/Proxy/IProxyConfiguration.cs index ab6d084f..6171dccd 100644 --- a/DevProxy.Abstractions/Proxy/IProxyConfiguration.cs +++ b/DevProxy.Abstractions/Proxy/IProxyConfiguration.cs @@ -18,6 +18,14 @@ public enum ReleaseType Beta } +public enum LogFor +{ + [EnumMember(Value = "human")] + Human, + [EnumMember(Value = "machine")] + Machine +} + public interface IProxyConfiguration { int ApiPort { get; set; } @@ -29,6 +37,7 @@ public interface IProxyConfiguration IEnumerable? FilterByHeaders { get; } bool InstallCert { get; set; } string? IPAddress { get; set; } + LogFor LogFor { get; } LogLevel LogLevel { get; } ReleaseType NewVersionNotification { get; } bool NoFirstRun { get; set; } diff --git a/DevProxy.Plugins/SharePoint/CsomParser.cs b/DevProxy.Plugins/SharePoint/CsomParser.cs index 9557d985..262aac1b 100644 --- a/DevProxy.Plugins/SharePoint/CsomParser.cs +++ b/DevProxy.Plugins/SharePoint/CsomParser.cs @@ -80,7 +80,7 @@ public static (IEnumerable Actions, IEnumerable Errors) GetActio } catch (Exception ex) { - Console.WriteLine($"Error parsing XML: {ex.Message}"); + errors.Add($"Error parsing XML: {ex.Message}"); } return (actions, errors); diff --git a/DevProxy/Commands/DevProxyCommand.cs b/DevProxy/Commands/DevProxyCommand.cs index b41848f0..032e0e2b 100644 --- a/DevProxy/Commands/DevProxyCommand.cs +++ b/DevProxy/Commands/DevProxyCommand.cs @@ -37,6 +37,7 @@ sealed class DevProxyCommand : RootCommand internal const string TimeoutOptionName = "--timeout"; internal const string DiscoverOptionName = "--discover"; internal const string EnvOptionName = "--env"; + internal const string LogForOptionName = "--log-for"; private static readonly string[] globalOptions = ["--version"]; private static readonly string[] helpOptions = ["--help", "-h", "/h", "-?", "/?"]; @@ -396,6 +397,24 @@ private void ConfigureCommand() } }); + var logForOption = new Option(LogForOptionName) + { + Description = $"Target audience for log output. Allowed values: {string.Join(", ", Enum.GetNames())}", + HelpName = "log-for", + Recursive = true + }; + logForOption.Validators.Add(input => + { + if (input.Tokens.Count == 0) + { + return; + } + if (!Enum.TryParse(input.Tokens[0].Value, true, out _)) + { + input.AddError($"{input.Tokens[0].Value} is not a valid log-for value. Allowed values are: {string.Join(", ", Enum.GetNames())}"); + } + }); + var options = new List