Logger (WIP)
This commit is contained in:
parent
3bca314ccd
commit
9467616f11
|
@ -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<LogMessage> Subject = new Subject<LogMessage>();
|
||||
|
||||
public static IObservable<LogMessage> Messages { get; } = Subject.ObserveOn(TaskPoolScheduler.Default);
|
||||
|
||||
|
||||
public static void Log(String message, Dictionary<String, String> properties, params String[] tags)
|
||||
{
|
||||
var t = new HashSet<String>(tags);
|
||||
Log(message, properties, t);
|
||||
}
|
||||
|
||||
private static void Log(String message, Dictionary<String, String> properties, HashSet<String> tags)
|
||||
{
|
||||
var logMessage = new LogMessage(message, tags, properties);
|
||||
Subject.OnNext(logMessage);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<Import Project="../InnovEnergy.Lib.props" />
|
||||
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="../Utils/Utils.csproj"/>
|
||||
<ProjectReference Include="../SrcGen/SrcGen.csproj"
|
||||
PrivateAssets="all"
|
||||
ReferenceOutputAssembly="false"
|
||||
OutputItemType="Analyzer"/>
|
||||
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
</Project>
|
Loading…
Reference in New Issue