mirror of
https://github.com/JustArchiNET/ArchiSteamFarm.git
synced 2026-01-10 05:34:25 +00:00
Move main ArchiLogger from ASF to Program
It makes more sense to put it in ASF class due to sharing potential, but I want to unify ArchiBoT logging and this makes it easier for maintenance
This commit is contained in:
@@ -33,7 +33,7 @@ namespace ArchiSteamFarm {
|
||||
|
||||
internal static void OnPersonaState(Bot bot, SteamFriends.PersonaStateCallback callback) {
|
||||
if (bot == null) {
|
||||
ASF.ArchiLogger.LogNullError(nameof(bot));
|
||||
Program.ArchiLogger.LogNullError(nameof(bot));
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ namespace GUI {
|
||||
|
||||
internal static void UpdateBotAvatar(string botName, Image image) {
|
||||
if (string.IsNullOrEmpty(botName) || (image == null)) {
|
||||
ASF.ArchiLogger.LogNullError(nameof(botName) + " || " + nameof(image));
|
||||
Program.ArchiLogger.LogNullError(nameof(botName) + " || " + nameof(image));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -68,10 +68,10 @@ namespace GUI {
|
||||
BotListView.LargeImageList = BotListView.SmallImageList = AvatarImageList;
|
||||
|
||||
await Task.Run(async () => {
|
||||
ASF.ArchiLogger.LogGenericInfo("ASF V" + SharedInfo.Version);
|
||||
Program.ArchiLogger.LogGenericInfo("ASF V" + SharedInfo.Version);
|
||||
|
||||
if (!Directory.Exists(SharedInfo.ConfigDirectory)) {
|
||||
ASF.ArchiLogger.LogGenericError("Config directory could not be found!");
|
||||
Program.ArchiLogger.LogGenericError("Config directory could not be found!");
|
||||
Environment.Exit(1);
|
||||
}
|
||||
|
||||
@@ -133,7 +133,7 @@ namespace GUI {
|
||||
|
||||
private static Bitmap ResizeImage(Image image, int width, int height) {
|
||||
if ((image == null) || (width <= 0) || (height <= 0)) {
|
||||
ASF.ArchiLogger.LogNullError(nameof(image) + " || " + nameof(width) + " || " + nameof(height));
|
||||
Program.ArchiLogger.LogNullError(nameof(image) + " || " + nameof(width) + " || " + nameof(height));
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -13,6 +13,8 @@ using SteamKit2;
|
||||
|
||||
namespace ArchiSteamFarm {
|
||||
internal static class Program {
|
||||
internal static readonly ArchiLogger ArchiLogger = new ArchiLogger(SharedInfo.ASF);
|
||||
|
||||
internal static GlobalConfig GlobalConfig { get; private set; }
|
||||
internal static GlobalDatabase GlobalDatabase { get; private set; }
|
||||
internal static WebBrowser WebBrowser { get; private set; }
|
||||
@@ -38,7 +40,7 @@ namespace ArchiSteamFarm {
|
||||
try {
|
||||
Process.Start(Assembly.GetEntryAssembly().Location, string.Join(" ", Environment.GetCommandLineArgs().Skip(1)));
|
||||
} catch (Exception e) {
|
||||
ASF.ArchiLogger.LogGenericException(e);
|
||||
ArchiLogger.LogGenericException(e);
|
||||
}
|
||||
|
||||
Environment.Exit(0);
|
||||
@@ -51,7 +53,7 @@ namespace ArchiSteamFarm {
|
||||
Logging.InitCoreLoggers();
|
||||
|
||||
if (!Runtime.IsRuntimeSupported) {
|
||||
ASF.ArchiLogger.LogGenericError("ASF detected unsupported runtime version, program might NOT run correctly in current environment. You're running it at your own risk!");
|
||||
ArchiLogger.LogGenericError("ASF detected unsupported runtime version, program might NOT run correctly in current environment. You're running it at your own risk!");
|
||||
}
|
||||
|
||||
string homeDirectory = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location);
|
||||
@@ -101,7 +103,7 @@ namespace ArchiSteamFarm {
|
||||
|
||||
GlobalConfig = GlobalConfig.Load(globalConfigFile);
|
||||
if (GlobalConfig == null) {
|
||||
ASF.ArchiLogger.LogGenericError("Global config could not be loaded, please make sure that " + globalConfigFile + " exists and is valid!");
|
||||
ArchiLogger.LogGenericError("Global config could not be loaded, please make sure that " + globalConfigFile + " exists and is valid!");
|
||||
Exit(1);
|
||||
}
|
||||
|
||||
@@ -109,14 +111,14 @@ namespace ArchiSteamFarm {
|
||||
|
||||
GlobalDatabase = GlobalDatabase.Load(globalDatabaseFile);
|
||||
if (GlobalDatabase == null) {
|
||||
ASF.ArchiLogger.LogGenericError("Global database could not be loaded, if issue persists, please remove " + globalDatabaseFile + " in order to recreate database!");
|
||||
ArchiLogger.LogGenericError("Global database could not be loaded, if issue persists, please remove " + globalDatabaseFile + " in order to recreate database!");
|
||||
Exit(1);
|
||||
}
|
||||
|
||||
ArchiWebHandler.Init();
|
||||
WebBrowser.Init();
|
||||
|
||||
WebBrowser = new WebBrowser(ASF.ArchiLogger);
|
||||
WebBrowser = new WebBrowser(ArchiLogger);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -132,20 +134,20 @@ namespace ArchiSteamFarm {
|
||||
|
||||
private static void UnhandledExceptionHandler(object sender, UnhandledExceptionEventArgs args) {
|
||||
if (args?.ExceptionObject == null) {
|
||||
ASF.ArchiLogger.LogNullError(nameof(args) + " || " + nameof(args.ExceptionObject));
|
||||
ArchiLogger.LogNullError(nameof(args) + " || " + nameof(args.ExceptionObject));
|
||||
return;
|
||||
}
|
||||
|
||||
ASF.ArchiLogger.LogFatalException((Exception) args.ExceptionObject);
|
||||
ArchiLogger.LogFatalException((Exception) args.ExceptionObject);
|
||||
}
|
||||
|
||||
private static void UnobservedTaskExceptionHandler(object sender, UnobservedTaskExceptionEventArgs args) {
|
||||
if (args?.Exception == null) {
|
||||
ASF.ArchiLogger.LogNullError(nameof(args) + " || " + nameof(args.Exception));
|
||||
ArchiLogger.LogNullError(nameof(args) + " || " + nameof(args.Exception));
|
||||
return;
|
||||
}
|
||||
|
||||
ASF.ArchiLogger.LogFatalException(args.Exception);
|
||||
ArchiLogger.LogFatalException(args.Exception);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user