Updated logger

This commit is contained in:
2024-05-21 21:00:31 +03:00
parent 8dbbfbfaef
commit 5731165d29
10 changed files with 50 additions and 35 deletions

View File

@@ -24,7 +24,7 @@ public class Exit: ICommandAction
{
if (args is null || args.Length == 0)
{
Application.CurrentApplication.Logger.Log("Exiting...", typeof(ICommandAction), LogType.WARNING);
Application.CurrentApplication.Logger.Log("Exiting...", this, LogType.WARNING);
await Application.CurrentApplication.ApplicationEnvironmentVariables.SaveToFile();
Environment.Exit(0);
}
@@ -40,7 +40,7 @@ public class Exit: ICommandAction
case "-f":
case "force":
Application.CurrentApplication.Logger.Log("Exiting (FORCE)...", typeof(ICommandAction), LogType.WARNING);
Application.CurrentApplication.Logger.Log("Exiting (FORCE)...", this, LogType.WARNING);
Environment.Exit(0);
break;

View File

@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Threading;
using System.Threading.Tasks;
@@ -148,15 +149,13 @@ internal static class PluginMethods
{
if (data.IsSuccess)
{
Application.CurrentApplication.Logger.Log("Successfully loaded command : " + data.PluginName, typeof(ICommandAction),
LogType.INFO
);
Application.CurrentApplication.Logger.Log("Successfully loaded command : " + data.PluginName, LogType.INFO, "\t\t > {Message}");
}
else
{
Application.CurrentApplication.Logger.Log("Failed to load command : " + data.PluginName + " because " + data.ErrorMessage,
typeof(ICommandAction), LogType.ERROR
typeof(PluginMethods), LogType.ERROR
);
}
@@ -166,14 +165,12 @@ internal static class PluginMethods
{
if (data.IsSuccess)
{
Application.CurrentApplication.Logger.Log("Successfully loaded event : " + data.PluginName, typeof(ICommandAction),
LogType.INFO
);
Application.CurrentApplication.Logger.Log("Successfully loaded event : " + data.PluginName, LogType.INFO, "\t\t > {Message}");
}
else
{
Application.CurrentApplication.Logger.Log("Failed to load event : " + data.PluginName + " because " + data.ErrorMessage,
typeof(ICommandAction), LogType.ERROR
typeof(PluginMethods), LogType.ERROR
);
}
@@ -184,14 +181,12 @@ internal static class PluginMethods
{
if (data.IsSuccess)
{
Application.CurrentApplication.Logger.Log("Successfully loaded slash command : " + data.PluginName, typeof(ICommandAction),
LogType.INFO
);
Application.CurrentApplication.Logger.Log("Successfully loaded slash command : " + data.PluginName, LogType.INFO, "\t\t > {Message}");
}
else
{
Application.CurrentApplication.Logger.Log("Failed to load slash command : " + data.PluginName + " because " + data.ErrorMessage,
typeof(ICommandAction), LogType.ERROR
typeof(PluginMethods), LogType.ERROR
);
}

View File

@@ -61,13 +61,13 @@ public class Plugin: ICommandAction
case "load":
if (pluginsLoaded)
{
Application.CurrentApplication.Logger.Log("Plugins already loaded", typeof(ICommandAction), LogType.WARNING);
Application.CurrentApplication.Logger.Log("Plugins already loaded", this, LogType.WARNING);
break;
}
if (Application.CurrentApplication.DiscordBotClient is null)
{
Application.CurrentApplication.Logger.Log("DiscordBot is null", typeof(ICommandAction), LogType.WARNING);
Application.CurrentApplication.Logger.Log("DiscordBot is null", this, LogType.WARNING);
break;
}