Zzz – Diff between revs 1 and 4
?pathlinks?
Rev 1 | Rev 4 | |||
---|---|---|---|---|
Line 53... | Line 53... | |||
53 | |
53 | |
|
Line 54... | Line 54... | |||
54 | private Idler _hibernateIdler; |
54 | private Idler _hibernateIdler; |
|
Line -... | Line 55... | |||
- | 55 | |
||
- | 56 | private LogMemorySink _memorySink; |
||
55 | |
57 | |
|
Line 56... | Line 58... | |||
56 | private LogMemorySink _memorySink; |
58 | private readonly object _memorySinkLock; |
|
Line 57... | Line 59... | |||
57 | |
59 | |
|
Line 69... | Line 71... | |||
69 | |
71 | |
|
70 | public MainForm(Mutex mutex) : this() |
72 | public MainForm(Mutex mutex) : this() |
|
71 | { |
73 | { |
|
72 | InitializeComponent(); |
74 | InitializeComponent(); |
|
- | 75 | _memorySink = new LogMemorySink(); |
||
Line -... | Line 76... | |||
- | 76 | _memorySinkLock = new object(); |
||
- | 77 | |
||
73 | _memorySink = new LogMemorySink(); |
78 | lock (_memorySinkLock) |
|
74 | |
79 | { |
|
- | 80 | Log.Logger = new LoggerConfiguration() |
||
75 | Log.Logger = new LoggerConfiguration() |
81 | .MinimumLevel.Debug() |
|
- | 82 | .WriteTo.Conditional(condition => MemorySinkEnabled, |
||
76 | .MinimumLevel.Debug() |
83 | configureSink => configureSink.Sink(_memorySink)) |
|
77 | .WriteTo.Conditional(condition => MemorySinkEnabled, configureSink => configureSink.Sink(_memorySink)) |
84 | .WriteTo.File( |
|
78 | .WriteTo.File(Path.Combine(Constants.UserApplicationDirectory, "Logs", $"{Constants.AssemblyName}.log"), |
85 | Path.Combine(Constants.UserApplicationDirectory, "Logs", $"{Constants.AssemblyName}.log"), |
|
- | 86 | rollingInterval: RollingInterval.Day) |
||
Line 79... | Line 87... | |||
79 | rollingInterval: RollingInterval.Day) |
87 | .CreateLogger(); |
|
80 | .CreateLogger(); |
88 | } |
|
81 | |
89 | |
|
Line 165... | Line 173... | |||
165 | if (_logViewForm != null) |
173 | if (_logViewForm != null) |
|
166 | { |
174 | { |
|
167 | return; |
175 | return; |
|
168 | } |
176 | } |
|
Line -... | Line 177... | |||
- | 177 | |
||
- | 178 | lock (_memorySinkLock) |
||
169 | |
179 | { |
|
170 | _logViewForm = new LogViewForm(this, _memorySink); |
180 | _logViewForm = new LogViewForm(this, _memorySink, _memorySinkLock); |
|
171 | _logViewForm.Closing += LogViewFormClosing; |
181 | _logViewForm.Closing += LogViewFormClosing; |
|
- | 182 | _logViewForm.Show(); |
||
172 | _logViewForm.Show(); |
183 | } |
|
Line 173... | Line 184... | |||
173 | } |
184 | } |
|
174 | |
185 | |
|
175 | private void LogViewFormClosing(object sender, CancelEventArgs e) |
186 | private void LogViewFormClosing(object sender, CancelEventArgs e) |