diff options
author | Wouter Tinus <win.acme.simple@gmail.com> | 2020-01-17 21:31:54 +0100 |
---|---|---|
committer | Wouter Tinus <win.acme.simple@gmail.com> | 2020-01-17 21:31:54 +0100 |
commit | 3bcf2aaab2bc674b45d648e0b266db75f3dcef82 (patch) | |
tree | e6b96e7f1a54b4467751a0c12fc1bbfcfa3acb6f | |
parent | f666e7001e0ead80c775cd78c540a12afc41a4cb (diff) | |
download | letsencrypt-win-simple-origin/2.1.3.zip letsencrypt-win-simple-origin/2.1.3.tar.gz letsencrypt-win-simple-origin/2.1.3.tar.bz2 |
Only use fancy colors in Windows 10 / Server 2016+v2.1.3.671origin/2.1.3
-rw-r--r-- | src/main.lib/Services/LogService.cs | 15 | ||||
-rw-r--r-- | src/main/app.manifest | 12 | ||||
-rw-r--r-- | src/main/wacs.csproj | 1 |
3 files changed, 26 insertions, 2 deletions
diff --git a/src/main.lib/Services/LogService.cs b/src/main.lib/Services/LogService.cs index c629a29..e54719c 100644 --- a/src/main.lib/Services/LogService.cs +++ b/src/main.lib/Services/LogService.cs @@ -6,6 +6,7 @@ using Serilog.Sinks.SystemConsole.Themes; using System; using System.Diagnostics; using System.IO; +using System.Runtime.InteropServices; namespace PKISharp.WACS.Services { @@ -32,17 +33,27 @@ namespace PKISharp.WACS.Services _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 0000000..3616d9c --- /dev/null +++ b/src/main/app.manifest @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="utf-8"?> +<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1"> + <compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1"> + <application> + <supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}" /> + <supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}" /> + <supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}" /> + <supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}" /> + <supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}" /> + </application> + </compatibility> +</assembly> diff --git a/src/main/wacs.csproj b/src/main/wacs.csproj index b563ec4..a7c3a71 100644 --- a/src/main/wacs.csproj +++ b/src/main/wacs.csproj @@ -9,6 +9,7 @@ <Version>2.1.2.0</Version> <AssemblyVersion>2.1.2.0</AssemblyVersion> <FileVersion>2.1.2.0</FileVersion> + <ApplicationManifest>app.manifest</ApplicationManifest> </PropertyGroup> <ItemGroup> |