-
-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathInMemorySinkAdvDebugProxy.cs
More file actions
28 lines (20 loc) · 849 Bytes
/
InMemorySinkAdvDebugProxy.cs
File metadata and controls
28 lines (20 loc) · 849 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#nullable enable
using System;
using System.Collections.Generic;
using System.Linq;
using Serilog.Events;
namespace Serilog.Sinks.InMemory
{
internal sealed class InMemorySinkAdvDebugProxy(InMemorySink sink)
: List<DebugLogEvent>(sink.LogEvents.Select(logEvent => new DebugLogEvent(logEvent)));
internal sealed class DebugLogEvent(LogEvent logEvent)
{
public LogEventLevel Level => logEvent.Level;
public string Message => logEvent.RenderMessage();
public string MessageTemplate => logEvent.MessageTemplate.ToString();
public IReadOnlyDictionary<string, LogEventPropertyValue> Properties => logEvent.Properties;
public Exception? Exception => logEvent.Exception;
public LogEvent OriginalLogEvent => logEvent;
public override string ToString() => Message;
}
}