From 8d2a2cd5de40e2b94ef5007c32832ed9a063dc40 Mon Sep 17 00:00:00 2001 From: chai <215380520@qq.com> Date: Thu, 12 Oct 2023 22:09:49 +0800 Subject: +hazel-networking --- .../Hazel-Networking/Hazel.UnitTests/TestLogger.cs | 66 ++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 Tools/Hazel-Networking/Hazel.UnitTests/TestLogger.cs (limited to 'Tools/Hazel-Networking/Hazel.UnitTests/TestLogger.cs') diff --git a/Tools/Hazel-Networking/Hazel.UnitTests/TestLogger.cs b/Tools/Hazel-Networking/Hazel.UnitTests/TestLogger.cs new file mode 100644 index 0000000..01ca893 --- /dev/null +++ b/Tools/Hazel-Networking/Hazel.UnitTests/TestLogger.cs @@ -0,0 +1,66 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Hazel.UnitTests +{ + public class TestLogger : ILogger + { + private readonly string prefix; + + public TestLogger(string prefix = "") + { + this.prefix = prefix; + } + + public void WriteVerbose(string msg) + { + if (string.IsNullOrEmpty(this.prefix)) + { + Console.WriteLine($"[VERBOSE] {msg}"); + } + else + { + Console.WriteLine($"[{this.prefix}][VERBOSE] {msg}"); + } + } + + public void WriteWarning(string msg) + { + if (string.IsNullOrEmpty(this.prefix)) + { + Console.WriteLine($"[WARN] {msg}"); + } + else + { + Console.WriteLine($"[{this.prefix}][WARN] {msg}"); + } + } + + public void WriteError(string msg) + { + if (string.IsNullOrEmpty(this.prefix)) + { + Console.WriteLine($"[ERROR] {msg}"); + } + else + { + Console.WriteLine($"[{this.prefix}][ERROR] {msg}"); + } + } + + public void WriteInfo(string msg) + { + if (string.IsNullOrEmpty(this.prefix)) + { + Console.WriteLine($"[INFO] {msg}"); + } + else + { + Console.WriteLine($"[{this.prefix}][INFO] {msg}"); + } + } + } +} -- cgit v1.1-26-g67d0