Winify – Diff between revs 44 and 61

Subversion Repositories:
Rev:
Only display areas with differencesIgnore whitespace
Rev 44 Rev 61
1 using System; 1 using System;
2 using System.Collections.ObjectModel; 2 using System.Collections.ObjectModel;
3 using System.IO; 3 using System.IO;
4 using Serilog.Core; 4 using Serilog.Core;
5 using Serilog.Events; 5 using Serilog.Events;
6 using Serilog.Formatting; 6 using Serilog.Formatting;
7 using Serilog.Formatting.Display; 7 using Serilog.Formatting.Display;
8   8  
9 namespace Winify 9 namespace Winify
10 { 10 {
11 public class LogMemorySink : ILogEventSink 11 public class LogMemorySink : ILogEventSink
12 { 12 {
13 private readonly ITextFormatter _textFormatter = 13 private readonly ITextFormatter _textFormatter =
14 new MessageTemplateTextFormatter( 14 new MessageTemplateTextFormatter(
15 "{Timestamp:yyyy-MM-dd HH:mm:ss.fff zzz} [{Level:u3}] {Message:l}{NewLine}{Exception}"); 15 "{Timestamp:yyyy-MM-dd HH:mm:ss.fff zzz} [{Level:u3}] {Message:l}{NewLine}{Exception}");
16   16  
17 public ObservableCollection<string> Events { get; } = new ObservableCollection<string>(); 17 public ObservableCollection<string> Events { get; } = new ObservableCollection<string>();
18   18  
19 public void Emit(LogEvent logEvent) 19 public void Emit(LogEvent logEvent)
20 { 20 {
21 if (logEvent == null) throw new ArgumentNullException(nameof(logEvent)); 21 if (logEvent == null) throw new ArgumentNullException(nameof(logEvent));
22   22  
23 using (var stringWriter = new StringWriter()) -  
24 { 23 using var stringWriter = new StringWriter();
25 _textFormatter.Format(logEvent, stringWriter); 24 _textFormatter.Format(logEvent, stringWriter);
26 Events.Add(stringWriter.ToString()); -  
27 } 25 Events.Add(stringWriter.ToString());
28 } 26 }
29   27  
30 public void Clear() 28 public void Clear()
31 { 29 {
32 Events.Clear(); 30 Events.Clear();
33 } 31 }
34 } 32 }
35 } 33 }
36   34  
37
Generated by GNU Enscript 1.6.5.90.
35
Generated by GNU Enscript 1.6.5.90.
38   36  
39   37  
40   38