Skip to content

Change unsupported culture log level #12153

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

Merged
merged 2 commits into from
Jul 24, 2019
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 @@ -16,11 +16,11 @@ internal static class RequestCultureProviderLoggerExtensions
static RequestCultureProviderLoggerExtensions()
{
_unsupportedCulture = LoggerMessage.Define<string, IList<StringSegment>>(
LogLevel.Warning,
LogLevel.Debug,
new EventId (1, "UnsupportedCulture"),
"{requestCultureProvider} returned the following unsupported cultures '{cultures}'.");
_unsupportedUICulture = LoggerMessage.Define<string, IList<StringSegment>>(
LogLevel.Warning,
LogLevel.Debug,
new EventId(2, "UnsupportedUICulture"),
"{requestCultureProvider} returned the following unsupported UI Cultures '{uiCultures}'.");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ public async Task GetDefaultCultureInfoIfCookieDoesNotExist()
}

[Fact]
public async Task RequestLocalizationMiddleware_LogsWarningsForUnsupportedCultures()
public async Task RequestLocalizationMiddleware_LogsDebugForUnsupportedCultures()
{
var sink = new TestSink(
TestSink.EnableWithTypeName<RequestLocalizationMiddleware>,
Expand Down Expand Up @@ -195,12 +195,12 @@ public async Task RequestLocalizationMiddleware_LogsWarningsForUnsupportedCultur
var expectedMessage = $"{nameof(CookieRequestCultureProvider)} returned the following unsupported cultures '??'.";

var write = Assert.Single(sink.Writes);
Assert.Equal(LogLevel.Warning, write.LogLevel);
Assert.Equal(LogLevel.Debug, write.LogLevel);
Assert.Equal(expectedMessage, write.State.ToString());
}

[Fact]
public async Task RequestLocalizationMiddleware_LogsWarningsForUnsupportedUICultures()
public async Task RequestLocalizationMiddleware_LogsDebugForUnsupportedUICultures()
{
var sink = new TestSink(
TestSink.EnableWithTypeName<RequestLocalizationMiddleware>,
Expand Down Expand Up @@ -247,7 +247,7 @@ public async Task RequestLocalizationMiddleware_LogsWarningsForUnsupportedUICult

var expectedMessage = $"{nameof(CookieRequestCultureProvider)} returned the following unsupported UI Cultures '??'.";
var write = Assert.Single(sink.Writes);
Assert.Equal(LogLevel.Warning, write.LogLevel);
Assert.Equal(LogLevel.Debug, write.LogLevel);
Assert.Equal(expectedMessage, write.State.ToString());
}
}
Expand Down