Zzz
/Zzz/MainForm.cs |
@@ -55,6 +55,8 @@ |
|
private LogMemorySink _memorySink; |
|
private readonly object _memorySinkLock; |
|
private LogViewForm _logViewForm; |
|
private SparkleUpdater _sparkle; |
@@ -71,13 +73,19 @@ |
{ |
InitializeComponent(); |
_memorySink = new LogMemorySink(); |
_memorySinkLock = new object(); |
|
Log.Logger = new LoggerConfiguration() |
.MinimumLevel.Debug() |
.WriteTo.Conditional(condition => MemorySinkEnabled, configureSink => configureSink.Sink(_memorySink)) |
.WriteTo.File(Path.Combine(Constants.UserApplicationDirectory, "Logs", $"{Constants.AssemblyName}.log"), |
rollingInterval: RollingInterval.Day) |
.CreateLogger(); |
lock (_memorySinkLock) |
{ |
Log.Logger = new LoggerConfiguration() |
.MinimumLevel.Debug() |
.WriteTo.Conditional(condition => MemorySinkEnabled, |
configureSink => configureSink.Sink(_memorySink)) |
.WriteTo.File( |
Path.Combine(Constants.UserApplicationDirectory, "Logs", $"{Constants.AssemblyName}.log"), |
rollingInterval: RollingInterval.Day) |
.CreateLogger(); |
} |
|
// Initialize the sleeper. |
_trigger = new ActionTrigger(Handle); |
@@ -167,9 +175,12 @@ |
return; |
} |
|
_logViewForm = new LogViewForm(this, _memorySink); |
_logViewForm.Closing += LogViewFormClosing; |
_logViewForm.Show(); |
lock (_memorySinkLock) |
{ |
_logViewForm = new LogViewForm(this, _memorySink, _memorySinkLock); |
_logViewForm.Closing += LogViewFormClosing; |
_logViewForm.Show(); |
} |
} |
|
private void LogViewFormClosing(object sender, CancelEventArgs e) |