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

Downgrade some log levels from info to debug #3206

Merged
merged 3 commits into from
Jul 7, 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
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,9 @@ public Task<CreateTestSessionResult> CreateTestSessionAsync(CreateTestSessionCon

public async Task ExecuteRequestAsync(ExecuteRequestContext context)
{
if (_logger.IsEnabled(LogLevel.Information))
if (_logger.IsEnabled(LogLevel.Debug))
{
await _logger.LogInformationAsync($"Executing request of type '{context.Request}'");
await _logger.LogDebugAsync($"Executing request of type '{context.Request}'");
}

switch (context.Request)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ protected override async Task<int> InternalRunAsync()
{
try
{
await _logger.LogInformationAsync("Starting server mode");
await _logger.LogDebugAsync("Starting server mode");
_messageHandler = await _messageHandlerFactory.CreateMessageHandlerAsync(_testApplicationCancellationTokenSource.CancellationToken);

// Initialize the ServerLoggerForwarderProvider, it can be null if diagnostic is disabled.
Expand Down Expand Up @@ -179,7 +179,7 @@ private async Task HandleMessagesAsync()
// Signal only one time
if (!_serverClosingTokenSource.IsCancellationRequested)
{
await _logger.LogInformationAsync("Server requested to shutdown");
await _logger.LogDebugAsync("Server requested to shutdown");
await _serverClosingTokenSource.CancelAsync();
}

Expand Down Expand Up @@ -371,14 +371,14 @@ private async Task<object> HandleRequestCoreAsync(RequestMessage message, RpcInv

AssertInitialized();

await _logger.LogInformationAsync($"Received {message.Method} request");
await _logger.LogDebugAsync($"Received {message.Method} request");

switch (message.Method, message.Params)
{
case (JsonRpcMethods.Initialize, InitializeRequestArgs args):
{
_client = new(args.ClientInfo.Name, args.ClientInfo.Version);
await _logger.LogInformationAsync($"Connection established with '{_client.Id}', protocol version {_client.Version}");
await _logger.LogDebugAsync($"Connection established with '{_client.Id}', protocol version {_client.Version}");

INamedFeatureCapability? namedFeatureCapability = ServiceProvider.GetTestFrameworkCapabilities().GetCapability<INamedFeatureCapability>();
return new InitializeResponseArgs(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,16 @@ public async Task<ITelemetryCollector> BuildAsync(ServiceProvider serviceProvide
bool isTelemetryOptedOut = !testApplicationOptions.EnableTelemetry;

ILogger<TelemetryManager> logger = loggerFactory.CreateLogger<TelemetryManager>();
await logger.LogInformationAsync($"TestApplicationOptions.EnableTelemetry: {testApplicationOptions.EnableTelemetry}");
await logger.LogDebugAsync($"TestApplicationOptions.EnableTelemetry: {testApplicationOptions.EnableTelemetry}");

// If the environment variable is not set or is set to 0, telemetry is opted in.
IEnvironment environment = serviceProvider.GetEnvironment();
string? telemetryOptOut = environment.GetEnvironmentVariable(EnvironmentVariableConstants.TESTINGPLATFORM_TELEMETRY_OPTOUT);
await logger.LogInformationAsync($"{EnvironmentVariableConstants.TESTINGPLATFORM_TELEMETRY_OPTOUT} environment variable: '{telemetryOptOut}'");
await logger.LogDebugAsync($"{EnvironmentVariableConstants.TESTINGPLATFORM_TELEMETRY_OPTOUT} environment variable: '{telemetryOptOut}'");
isTelemetryOptedOut = (telemetryOptOut is "1" or "true") || isTelemetryOptedOut;

string? cli_telemetryOptOut = environment.GetEnvironmentVariable(EnvironmentVariableConstants.DOTNET_CLI_TELEMETRY_OPTOUT);
await logger.LogInformationAsync($"{EnvironmentVariableConstants.DOTNET_CLI_TELEMETRY_OPTOUT} environment variable: '{cli_telemetryOptOut}'");
await logger.LogDebugAsync($"{EnvironmentVariableConstants.DOTNET_CLI_TELEMETRY_OPTOUT} environment variable: '{cli_telemetryOptOut}'");
isTelemetryOptedOut = (cli_telemetryOptOut is "1" or "true") || isTelemetryOptedOut;

// NO_LOGO
Expand All @@ -54,14 +54,14 @@ public async Task<ITelemetryCollector> BuildAsync(ServiceProvider serviceProvide
bool doNotShowLogo = commandLineOptions.IsOptionSet(PlatformCommandLineProvider.NoBannerOptionKey);

string? noBannerEnvVar = environment.GetEnvironmentVariable(EnvironmentVariableConstants.TESTINGPLATFORM_NOBANNER);
await logger.LogInformationAsync($"{EnvironmentVariableConstants.TESTINGPLATFORM_NOBANNER} environment variable: '{noBannerEnvVar}'");
await logger.LogDebugAsync($"{EnvironmentVariableConstants.TESTINGPLATFORM_NOBANNER} environment variable: '{noBannerEnvVar}'");
doNotShowLogo = (noBannerEnvVar is "1" or "true") || doNotShowLogo;

string? dotnetNoLogoEnvVar = environment.GetEnvironmentVariable(EnvironmentVariableConstants.DOTNET_NOLOGO);
await logger.LogInformationAsync($"{EnvironmentVariableConstants.DOTNET_NOLOGO} environment variable: '{dotnetNoLogoEnvVar}'");
await logger.LogDebugAsync($"{EnvironmentVariableConstants.DOTNET_NOLOGO} environment variable: '{dotnetNoLogoEnvVar}'");
doNotShowLogo = (dotnetNoLogoEnvVar is "1" or "true") || doNotShowLogo;

await logger.LogInformationAsync($"Telemetry is '{(!isTelemetryOptedOut ? "ENABLED" : "DISABLED")}'");
await logger.LogDebugAsync($"Telemetry is '{(!isTelemetryOptedOut ? "ENABLED" : "DISABLED")}'");

if (!isTelemetryOptedOut && !doNotShowLogo)
{
Expand Down Expand Up @@ -115,7 +115,7 @@ public async Task<ITelemetryCollector> BuildAsync(ServiceProvider serviceProvide

if (!isTelemetryOptedOut)
{
await logger.LogInformationAsync($"Telemetry collector provider: '{telemetryCollector.GetType()}'");
await logger.LogDebugAsync($"Telemetry collector provider: '{telemetryCollector.GetType()}'");
}

return telemetryCollector;
Expand Down
Loading