Skip to content

Commit

Permalink
Don't create chat logger if disabled in config
Browse files Browse the repository at this point in the history
  • Loading branch information
ethanmoffat committed Jun 14, 2022
1 parent 07c97ec commit d101233
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions EOLib/Domain/Chat/ChatLoggerProvider.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using AutomaticTypeMapper;
using EOLib.Config;
using EOLib.Logger;
using System;

Expand All @@ -14,9 +15,12 @@ public class ChatLoggerProvider : IChatLoggerProvider
{
public ILogger ChatLogger { get; }

public ChatLoggerProvider(ILoggerFactory loggerFactory)
public ChatLoggerProvider(IConfigurationProvider configurationProvider, ILoggerFactory loggerFactory)
{
ChatLogger = loggerFactory.CreateLogger<FileLogger>(Constants.ChatLogFile);
if (configurationProvider.LogChatToFile)
ChatLogger = loggerFactory.CreateLogger<FileLogger>(Constants.ChatLogFile);
else
ChatLogger = loggerFactory.CreateLogger<NullLogger>();
}

public void Dispose()
Expand Down

0 comments on commit d101233

Please sign in to comment.