mirror of
https://github.com/MCCTeam/Minecraft-Console-Client
synced 2025-10-14 21:22:49 +00:00
Implement new logger (#1426)
* Implement multi-channel logger * Implement chat filter * Improve a bit * Improvement * Add debug message filter and filter mode * Avoid duplicate debug prefix string Co-authored-by: ORelio <ORelio@users.noreply.github.com>
This commit is contained in:
parent
939c8fb383
commit
38a890f840
9 changed files with 277 additions and 43 deletions
|
|
@ -94,12 +94,22 @@ namespace MinecraftClient
|
|||
public static bool InventoryHandling = false;
|
||||
public static string PrivateMsgsCmdName = "tell";
|
||||
public static CacheType SessionCaching = CacheType.Disk;
|
||||
public static bool DebugMessages = false;
|
||||
public static bool ResolveSrvRecords = true;
|
||||
public static bool ResolveSrvRecordsShortTimeout = true;
|
||||
public static bool EntityHandling = false;
|
||||
public static bool AutoRespawn = false;
|
||||
|
||||
// Logging
|
||||
public enum FilterModeEnum { Blacklist, Whitelist }
|
||||
public static bool DebugMessages = false;
|
||||
public static bool ChatMessages = true;
|
||||
public static bool InfoMessages = true;
|
||||
public static bool WarningMessages = true;
|
||||
public static bool ErrorMessages = true;
|
||||
public static Regex ChatFilter = null;
|
||||
public static Regex DebugFilter = null;
|
||||
public static FilterModeEnum FilterMode = FilterModeEnum.Blacklist;
|
||||
|
||||
//AntiAFK Settings
|
||||
public static bool AntiAFK_Enabled = false;
|
||||
public static int AntiAFK_Delay = 600;
|
||||
|
|
@ -197,7 +207,7 @@ namespace MinecraftClient
|
|||
private static readonly Dictionary<string, KeyValuePair<string, ushort>> Servers = new Dictionary<string, KeyValuePair<string, ushort>>();
|
||||
|
||||
|
||||
private enum ParseMode { Default, Main, AppVars, Proxy, MCSettings, AntiAFK, Hangman, Alerts, ChatLog, AutoRelog, ScriptScheduler, RemoteControl, ChatFormat, AutoRespond, AutoAttack, AutoFishing, AutoEat, AutoCraft, AutoDrop, Mailer, ReplayMod };
|
||||
private enum ParseMode { Default, Main, AppVars, Proxy, MCSettings, AntiAFK, Hangman, Alerts, ChatLog, AutoRelog, ScriptScheduler, RemoteControl, ChatFormat, AutoRespond, AutoAttack, AutoFishing, AutoEat, AutoCraft, AutoDrop, Mailer, ReplayMod, Logging };
|
||||
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -246,6 +256,7 @@ namespace MinecraftClient
|
|||
case "mailer": pMode = ParseMode.Mailer; break;
|
||||
case "autodrop": pMode = ParseMode.AutoDrop; break;
|
||||
case "replaymod": pMode = ParseMode.ReplayMod; break;
|
||||
case "logging": pMode = ParseMode.Logging; break;
|
||||
|
||||
default: pMode = ParseMode.Default; break;
|
||||
}
|
||||
|
|
@ -285,8 +296,9 @@ namespace MinecraftClient
|
|||
case "enableentityhandling": EntityHandling = str2bool(argValue); break;
|
||||
case "inventoryhandling": InventoryHandling = str2bool(argValue); break;
|
||||
case "privatemsgscmdname": PrivateMsgsCmdName = argValue.ToLower().Trim(); break;
|
||||
case "debugmessages": DebugMessages = str2bool(argValue); break;
|
||||
case "autorespawn": AutoRespawn = str2bool(argValue); break;
|
||||
// Backward compatible so people can still enable debug with old config format
|
||||
case "debugmessages": DebugMessages = str2bool(argValue); break;
|
||||
|
||||
case "botowners":
|
||||
Bots_Owners.Clear();
|
||||
|
|
@ -396,6 +408,25 @@ namespace MinecraftClient
|
|||
}
|
||||
break;
|
||||
|
||||
case ParseMode.Logging:
|
||||
switch (argName.ToLower())
|
||||
{
|
||||
case "debugmessages": DebugMessages = str2bool(argValue); break;
|
||||
case "chatmessages": ChatMessages = str2bool(argValue); break;
|
||||
case "warningmessages": WarningMessages = str2bool(argValue); break;
|
||||
case "errormessages": ErrorMessages = str2bool(argValue); break;
|
||||
case "infomessages": InfoMessages = str2bool(argValue); break;
|
||||
case "chatfilter": ChatFilter = new Regex(argValue); break;
|
||||
case "debugfilter": DebugFilter = new Regex(argValue); break;
|
||||
case "filtermode":
|
||||
if (argValue.ToLower().StartsWith("white"))
|
||||
FilterMode = FilterModeEnum.Whitelist;
|
||||
else
|
||||
FilterMode = FilterModeEnum.Blacklist;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case ParseMode.Alerts:
|
||||
switch (argName.ToLower())
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue