From 58c4a251fd13c646fa62fb5c5751119a43ef0d62 Mon Sep 17 00:00:00 2001 From: Lior Banai Date: Wed, 15 Nov 2023 16:20:32 +0200 Subject: [PATCH] Analogy.LogViewer.Serilog.Sinks NET8 --- .../Analogy.LogViewer.Serilog.Sinks.csproj | 22 ++++--------------- .../AnalogyLogServerSink.cs | 8 +++---- .../AnalogyLogServerSinkExtensions.cs | 8 +++---- Analogy.LogViewer.Serilog.Sinks/Constants.cs | 3 +-- 4 files changed, 12 insertions(+), 29 deletions(-) diff --git a/Analogy.LogViewer.Serilog.Sinks/Analogy.LogViewer.Serilog.Sinks.csproj b/Analogy.LogViewer.Serilog.Sinks/Analogy.LogViewer.Serilog.Sinks.csproj index 693f95c..8e56294 100644 --- a/Analogy.LogViewer.Serilog.Sinks/Analogy.LogViewer.Serilog.Sinks.csproj +++ b/Analogy.LogViewer.Serilog.Sinks/Analogy.LogViewer.Serilog.Sinks.csproj @@ -1,14 +1,14 @@ - net7.0-windows;net6.0-windows;net48;net471 + net8.0-windows;net7.0-windows;net6.0-windows;net48;net471 true true true snupkg true true - 5.0.3.1 + 6.0.0 Lior Banai Analogy.LogViewer @@ -28,22 +28,8 @@ - - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - - - - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - - + + diff --git a/Analogy.LogViewer.Serilog.Sinks/AnalogyLogServerSink.cs b/Analogy.LogViewer.Serilog.Sinks/AnalogyLogServerSink.cs index e74a804..2a5239b 100644 --- a/Analogy.LogViewer.Serilog.Sinks/AnalogyLogServerSink.cs +++ b/Analogy.LogViewer.Serilog.Sinks/AnalogyLogServerSink.cs @@ -17,6 +17,7 @@ public AnalogyLogServerSink(IFormatProvider formatProvider) _formatProvider = formatProvider; logServerMessageProducer = new AnalogyMessageProducer("http://localhost:6000"); } + /// /// /// @@ -29,10 +30,9 @@ public AnalogyLogServerSink(IFormatProvider formatProvider, string address) } public void Emit(LogEvent logEvent) { - var alm = ParseLogEventProperties(logEvent, in _formatProvider); - logServerMessageProducer?.Log(alm.Text, alm.Source, alm.Level, "", alm.MachineName, alm.User, - alm.Module, alm.ProcessId, alm.ThreadId, alm.AdditionalProperties, alm.MethodName, alm.LineNumber, alm.FileName); + _ = (logServerMessageProducer?.Log(alm.Text, alm.Source, alm.Level, "", alm.MachineName, alm.User, + alm.Module, alm.ProcessId, alm.ThreadId, alm.AdditionalProperties, alm.MethodName, alm.LineNumber, alm.FileName)); } public static AnalogyLogMessage ParseLogEventProperties(LogEvent evt, in IFormatProvider formatProvider) @@ -160,4 +160,4 @@ public void Dispose() logServerMessageProducer.Dispose(); } } -} +} \ No newline at end of file diff --git a/Analogy.LogViewer.Serilog.Sinks/AnalogyLogServerSinkExtensions.cs b/Analogy.LogViewer.Serilog.Sinks/AnalogyLogServerSinkExtensions.cs index c4de498..beb7cd3 100644 --- a/Analogy.LogViewer.Serilog.Sinks/AnalogyLogServerSinkExtensions.cs +++ b/Analogy.LogViewer.Serilog.Sinks/AnalogyLogServerSinkExtensions.cs @@ -1,8 +1,6 @@ -using System; -using System.Collections.Generic; -using System.Text; -using Serilog; +using Serilog; using Serilog.Configuration; +using System; namespace Analogy.LogViewer.Serilog.Sinks { @@ -17,4 +15,4 @@ public static LoggerConfiguration AnalogyLogServerSink(this LoggerSinkConfigurat return loggerConfiguration.Sink(new AnalogyLogServerSink(formatProvider, address)); } } -} +} \ No newline at end of file diff --git a/Analogy.LogViewer.Serilog.Sinks/Constants.cs b/Analogy.LogViewer.Serilog.Sinks/Constants.cs index fbae868..0c9682f 100644 --- a/Analogy.LogViewer.Serilog.Sinks/Constants.cs +++ b/Analogy.LogViewer.Serilog.Sinks/Constants.cs @@ -22,6 +22,5 @@ public static Dictionary GetFieldValues() .Where(f => f.FieldType == typeof(string)) .ToDictionary(f => f.Name, f => (string)f.GetValue(null)); } - } -} +} \ No newline at end of file