From 2ebedc7a7d9da49ab0808f2b7c073d2641950361 Mon Sep 17 00:00:00 2001 From: Marc Hernandez Date: Thu, 7 Mar 2024 17:33:01 -0800 Subject: [PATCH] x) Update to 8 x) Respect logging types --- SharpLib.csproj | 2 +- logging/Log.cs | 22 ++++++++++++++-------- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/SharpLib.csproj b/SharpLib.csproj index 82a9526..8713be8 100644 --- a/SharpLib.csproj +++ b/SharpLib.csproj @@ -1,7 +1,7 @@  - net6.0 + net8.0 lib 0.0.1.0 0.0.1.0 diff --git a/logging/Log.cs b/logging/Log.cs index 25a95db..119bfec 100644 --- a/logging/Log.cs +++ b/logging/Log.cs @@ -31,7 +31,8 @@ static public class log [Flags] public enum Endpoints { - Invalid = 0, + None = 0, + File = 1 << 0, Console = 1 << 1, @@ -249,6 +250,7 @@ static public class log } } + static Endpoints s_endpoints = Endpoints.Console; static void startup( string filename, Endpoints endpoints ) { @@ -411,11 +413,17 @@ static public class log //Console.WriteLine( finalMsg ); //Console.Out.Write( finalMsg ); - s_writer.WriteLine( finalLine ); + if( (s_endpoints & Endpoints.File) == Endpoints.File ) + { + s_writer.WriteLine( finalLine ); + } - setConsoleColor( evt ); - Console.WriteLine( finalLine ); - Console.ResetColor(); + if( (s_endpoints & Endpoints.Console) == Endpoints.Console ) + { + setConsoleColor( evt ); + Console.WriteLine( finalLine ); + Console.ResetColor(); + } //Debug.WriteLine( finalLine ); @@ -424,9 +432,7 @@ static public class log foreach( Log_delegate cb in s_delegates ) { - { - cb( evt ); - } + cb( evt ); } } }