Implement log to file logger (#1494)

* Implement log to file

Logger moved to it's own namespace

* Add lock to log file
This commit is contained in:
ReinforceZwei 2021-03-07 14:23:26 +08:00 committed by GitHub
parent 62c985376e
commit 240468ad22
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 306 additions and 144 deletions

View file

@ -12,6 +12,7 @@ using MinecraftClient.Proxy;
using MinecraftClient.Protocol.Handlers.Forge;
using MinecraftClient.Mapping;
using MinecraftClient.Inventory;
using MinecraftClient.Logger;
namespace MinecraftClient
{
@ -176,7 +177,9 @@ namespace MinecraftClient
this.port = port;
this.protocolversion = protocolversion;
this.Log = new MCLogger();
this.Log = Settings.LogToFile
? new FileLogLogger(Settings.ExpandVars(Settings.LogFile), Settings.PrependTimestamp)
: new FilteredLogger();
Log.DebugEnabled = Settings.DebugMessages;
Log.InfoEnabled = Settings.InfoMessages;
Log.ChatEnabled = Settings.ChatMessages;