From d10123391d29e06fa77dd7b9a95300655373a909 Mon Sep 17 00:00:00 2001 From: Ethan Moffat Date: Mon, 13 Jun 2022 18:18:11 -0700 Subject: [PATCH] Don't create chat logger if disabled in config --- EOLib/Domain/Chat/ChatLoggerProvider.cs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/EOLib/Domain/Chat/ChatLoggerProvider.cs b/EOLib/Domain/Chat/ChatLoggerProvider.cs index 93fdbbc54..c6cc93bc2 100644 --- a/EOLib/Domain/Chat/ChatLoggerProvider.cs +++ b/EOLib/Domain/Chat/ChatLoggerProvider.cs @@ -1,4 +1,5 @@ using AutomaticTypeMapper; +using EOLib.Config; using EOLib.Logger; using System; @@ -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(Constants.ChatLogFile); + if (configurationProvider.LogChatToFile) + ChatLogger = loggerFactory.CreateLogger(Constants.ChatLogFile); + else + ChatLogger = loggerFactory.CreateLogger(); } public void Dispose()