diff --git a/src/main.lib/Services/LogService.cs b/src/main.lib/Services/LogService.cs index c629a2925..e54719c33 100644 --- a/src/main.lib/Services/LogService.cs +++ b/src/main.lib/Services/LogService.cs @@ -6,6 +6,7 @@ using System; using System.Diagnostics; using System.IO; +using System.Runtime.InteropServices; namespace PKISharp.WACS.Services { @@ -32,17 +33,27 @@ public LogService() _levelSwitch = new LoggingLevelSwitch(initialMinimumLevel: initialLevel); try { + var theme = + RuntimeInformation.IsOSPlatform(OSPlatform.Windows) && + Environment.OSVersion.Version.Major == 10 ? + (ConsoleTheme)AnsiConsoleTheme.Code : + SystemConsoleTheme.Literate; + _screenLogger = new LoggerConfiguration() .MinimumLevel.ControlledBy(_levelSwitch) .Enrich.FromLogContext() .Filter.ByIncludingOnly(x => { Dirty = true; return true; }) - .WriteTo.Console(outputTemplate: " {Message:l}{NewLine}", theme: AnsiConsoleTheme.Code) + .WriteTo.Console( + outputTemplate: " {Message:l}{NewLine}", + theme: theme) .CreateLogger(); _debugScreenLogger = new LoggerConfiguration() .MinimumLevel.ControlledBy(_levelSwitch) .Enrich.FromLogContext() .Filter.ByIncludingOnly(x => { Dirty = true; return true; }) - .WriteTo.Console(outputTemplate: " [{Level:u4}] {Message:l}{NewLine}{Exception}", theme: AnsiConsoleTheme.Code) + .WriteTo.Console( + outputTemplate: " [{Level:u4}] {Message:l}{NewLine}{Exception}", + theme: theme) .CreateLogger(); } catch (Exception ex) diff --git a/src/main/app.manifest b/src/main/app.manifest new file mode 100644 index 000000000..3616d9cd9 --- /dev/null +++ b/src/main/app.manifest @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/src/main/wacs.csproj b/src/main/wacs.csproj index b563ec469..a7c3a71c9 100644 --- a/src/main/wacs.csproj +++ b/src/main/wacs.csproj @@ -9,6 +9,7 @@ 2.1.2.0 2.1.2.0 2.1.2.0 + app.manifest