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

Universal Output wasn't actually universal #8072

Merged
merged 3 commits into from
Apr 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public static RootCommand GenerateCommandLineOptions(Func<DefaultOptions, Task>
dumpOption.AddAlias("-d");

var universalOption = new Option<bool>(
name: "--universalOutput",
name: "--universal",
description: "Flag; Redirect all logs to stdout, including what would normally be showing up on stderr.",
getDefaultValue: () => false);
universalOption.AddAlias("-u");
Expand Down Expand Up @@ -83,6 +83,7 @@ public static RootCommand GenerateCommandLineOptions(Func<DefaultOptions, Task>
var startCommand = new Command("start", "Start the TestProxy.");
startCommand.AddOption(insecureOption);
startCommand.AddOption(dumpOption);
startCommand.AddOption(universalOption);
startCommand.AddArgument(collectedArgs);

startCommand.SetHandler(async (startOpts) => await callback(startOpts),
Expand Down
10 changes: 7 additions & 3 deletions tools/test-proxy/Azure.Sdk.Tools.TestProxy/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -147,10 +147,14 @@ private static void StartServer(StartOptions startOptions)
{
loggingBuilder.ClearProviders();
loggingBuilder.AddConfiguration(hostBuilder.Configuration.GetSection("Logging"));
loggingBuilder.AddConsole(options =>
if (!startOptions.UniversalOutput)
{
options.LogToStandardErrorThreshold = startOptions.UniversalOutput ? LogLevel.None : LogLevel.Error;
}).AddSimpleConsole(options =>
loggingBuilder.AddConsole(options =>
{
options.LogToStandardErrorThreshold = LogLevel.Error;
});
}
loggingBuilder.AddSimpleConsole(options =>
{
options.TimestampFormat = "[HH:mm:ss] ";
});
Expand Down