aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJP Dillingham <jpdillingham@gmail.com>2021-10-04 18:50:48 -0500
committerJP Dillingham <jpdillingham@gmail.com>2021-10-04 18:50:48 -0500
commitf94744408cac94ffe096d4c5e7b646d37a52291d (patch)
tree494d8d0354421f39ce86c71c434dd2eca7da6e2d /src
parentd19c9e340397071599498d2adb03a4654492bd15 (diff)
downloadslskd-f94744408cac94ffe096d4c5e7b646d37a52291d.tar.gz
add DelegatingSink
Diffstat (limited to 'src')
-rw-r--r--src/slskd/Common/DelegatingSink.cs38
1 files changed, 38 insertions, 0 deletions
diff --git a/src/slskd/Common/DelegatingSink.cs b/src/slskd/Common/DelegatingSink.cs
new file mode 100644
index 00000000..75b0e60f
--- /dev/null
+++ b/src/slskd/Common/DelegatingSink.cs
@@ -0,0 +1,38 @@
+// <copyright file="DelegatingSink.cs" company="slskd Team">
+// Copyright (c) slskd Team. All rights reserved.
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU Affero General Public License as published
+// by the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Affero General Public License for more details.
+//
+// You should have received a copy of the GNU Affero General Public License
+// along with this program. If not, see https://www.gnu.org/licenses/.
+// </copyright>
+
+namespace slskd
+{
+ using System;
+ using Serilog.Core;
+ using Serilog.Events;
+
+ public class DelegatingSink : ILogEventSink
+ {
+ public DelegatingSink(Action<LogEvent> action)
+ {
+ Action = action;
+ }
+
+ private Action<LogEvent> Action { get; }
+
+ public void Emit(LogEvent logEvent)
+ {
+ Action(logEvent);
+ }
+ }
+} \ No newline at end of file