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

Extensions.Logging.Console: Only check for Android/Apple mobile on netcoreapp configs #74798

Merged
merged 5 commits into from
Aug 31, 2022
Merged
Changes from 2 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 @@ -15,10 +15,13 @@ internal sealed class SimpleConsoleFormatter : ConsoleFormatter, IDisposable
private const string LoglevelPadding = ": ";
private static readonly string _messagePadding = new string(' ', GetLogLevelString(LogLevel.Information).Length + LoglevelPadding.Length);
private static readonly string _newLineWithMessagePadding = Environment.NewLine + _messagePadding;
private static readonly bool _isAndroidOrAppleMobile = RuntimeInformation.IsOSPlatform(OSPlatform.Create("ANDROID"))
|| RuntimeInformation.IsOSPlatform(OSPlatform.Create("TVOS"))
|| RuntimeInformation.IsOSPlatform(OSPlatform.Create("IOS"))
|| RuntimeInformation.IsOSPlatform(OSPlatform.Create("MACCATALYST"));
#if NETCOREAPP
private static readonly bool _isAndroidOrAppleMobile => OperatingSystem.IsAndroid()
|| OperatingSystem.IsTvOS()
|| OperatingSystem.IsIOS(); // returns true on MacCatalyst
#else
private const bool _isAndroidOrAppleMobile = false;
#endif
private IDisposable? _optionsReloadToken;

public SimpleConsoleFormatter(IOptionsMonitor<SimpleConsoleFormatterOptions> options)
Expand Down