From 9467616f11cd0ffdb233ee8ad7ea79d13e291370 Mon Sep 17 00:00:00 2001 From: ig Date: Tue, 13 Jun 2023 13:02:36 +0200 Subject: [PATCH] Logger (WIP) --- csharp/Lib/Logging/Log.cs | 30 ++++++++++++++++++++++++++++++ csharp/Lib/Logging/Logging.csproj | 16 ++++++++++++++++ 2 files changed, 46 insertions(+) create mode 100644 csharp/Lib/Logging/Log.cs create mode 100644 csharp/Lib/Logging/Logging.csproj diff --git a/csharp/Lib/Logging/Log.cs b/csharp/Lib/Logging/Log.cs new file mode 100644 index 000000000..7a532924b --- /dev/null +++ b/csharp/Lib/Logging/Log.cs @@ -0,0 +1,30 @@ +using System.Reactive.Concurrency; +using System.Reactive.Linq; +using System.Reactive.Subjects; + +namespace InnovEnergy.Lib.Logging; + +public static class Logger +{ + private static readonly Subject Subject = new Subject(); + + public static IObservable Messages { get; } = Subject.ObserveOn(TaskPoolScheduler.Default); + + + public static void Log(String message, Dictionary properties, params String[] tags) + { + var t = new HashSet(tags); + Log(message, properties, t); + } + + private static void Log(String message, Dictionary properties, HashSet tags) + { + var logMessage = new LogMessage(message, tags, properties); + Subject.OnNext(logMessage); + } + + + + + +} \ No newline at end of file diff --git a/csharp/Lib/Logging/Logging.csproj b/csharp/Lib/Logging/Logging.csproj new file mode 100644 index 000000000..279fa8e59 --- /dev/null +++ b/csharp/Lib/Logging/Logging.csproj @@ -0,0 +1,16 @@ + + + + + + + + + + + + +