Fixed multiple logs being written to the same bot instance
All checks were successful
EllieBotDevs/EllieHub/pipeline/head This commit looks good
All checks were successful
EllieBotDevs/EllieHub/pipeline/head This commit looks good
This commit is contained in:
parent
7fa866369c
commit
2a8cd606c5
4 changed files with 10 additions and 5 deletions
|
@ -57,7 +57,7 @@ dotnet_diagnostic.CA1832.severity = warning
|
|||
dotnet_diagnostic.CA1833.severity = warning
|
||||
dotnet_diagnostic.CA1842.severity = warning
|
||||
dotnet_diagnostic.CA1843.severity = warning
|
||||
dotnet_diagnostic.CA1836.severity = warning
|
||||
dotnet_diagnostic.CA1836.severity = none
|
||||
dotnet_diagnostic.CA1839.severity = warning
|
||||
dotnet_diagnostic.CA1840.severity = warning
|
||||
dotnet_diagnostic.CA1846.severity = warning
|
||||
|
@ -1168,7 +1168,7 @@ resharper_arrange_default_value_when_type_evident_highlighting = suggestion
|
|||
resharper_arrange_default_value_when_type_not_evident_highlighting = suggestion
|
||||
resharper_arrange_local_function_body_highlighting = error
|
||||
resharper_arrange_method_or_operator_body_highlighting = error
|
||||
resharper_arrange_missing_parentheses_highlighting = hint
|
||||
resharper_arrange_missing_parentheses_highlighting = none
|
||||
resharper_arrange_namespace_body_highlighting = error
|
||||
resharper_arrange_object_creation_when_type_evident_highlighting = suggestion
|
||||
resharper_arrange_object_creation_when_type_not_evident_highlighting = suggestion
|
||||
|
|
|
@ -12,7 +12,6 @@
|
|||
<GenerateDocumentationFile>True</GenerateDocumentationFile>
|
||||
<BuiltInComInteropSupport>True</BuiltInComInteropSupport>
|
||||
<ApplicationIcon>Assets/Light/ellieupdatericon.ico</ApplicationIcon>
|
||||
<NoWarn>CA1836</NoWarn>
|
||||
|
||||
<!--Publishing-->
|
||||
<PublishSingleFile>true</PublishSingleFile>
|
||||
|
|
|
@ -11,7 +11,7 @@ namespace EllieHub.Features.BotConfig.Services;
|
|||
/// </summary>
|
||||
public sealed class LogWriter : ILogWriter
|
||||
{
|
||||
private readonly Dictionary<Guid, StringBuilder> _botLogs = new();
|
||||
private readonly Dictionary<Guid, StringBuilder> _botLogs = [];
|
||||
private readonly ReadOnlyAppSettings _appConfig;
|
||||
|
||||
/// <inheritdoc/>
|
||||
|
@ -48,7 +48,7 @@ public sealed class LogWriter : ILogWriter
|
|||
var botEntry = _appConfig.BotEntries[botId];
|
||||
var now = DateTimeOffset.Now;
|
||||
var date = new DateOnly(now.Year, now.Month, now.Day).ToShortDateString().Replace('/', '-');
|
||||
var fileUri = Path.Combine(_appConfig.LogsDirectoryUri, $"{botEntry.Name}_v{botEntry.Version}_{date}-{now.ToUnixTimeSeconds()}.txt");
|
||||
var fileUri = Path.Join(_appConfig.LogsDirectoryUri, $"{botEntry.Name}_v{botEntry.Version}_{date}-{now.ToUnixTimeSeconds()}.txt");
|
||||
|
||||
await File.WriteAllTextAsync(fileUri, logStringBuilder.ToString(), cToken);
|
||||
|
||||
|
|
|
@ -506,6 +506,12 @@ public class BotConfigViewModel : ViewModelBase<BotConfigView>, IDisposable
|
|||
/// <inheritdoc/>
|
||||
public void Dispose()
|
||||
{
|
||||
UpdateBar.Click -= InstallOrUpdateAsync;
|
||||
_botOrchestrator.OnStdout -= WriteLog;
|
||||
_botOrchestrator.OnStderr -= WriteLog;
|
||||
_botOrchestrator.OnBotExit -= LogBotExit;
|
||||
_botOrchestrator.OnBotExit -= ReenableButtonsOnBotExit;
|
||||
|
||||
BotAvatar.Dispose();
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue