mirror of
https://github.com/JustArchiNET/ArchiSteamFarm.git
synced 2026-02-06 04:53:39 +00:00
Use ASF instead of Main for global logging routines, closes #280
This commit is contained in:
@@ -114,7 +114,7 @@ namespace ArchiSteamFarm {
|
||||
LogManager.ReconfigExistingLoggers();
|
||||
}
|
||||
|
||||
internal static void LogGenericError(string message, string botName = "Main", [CallerMemberName] string previousMethodName = null) {
|
||||
internal static void LogGenericError(string message, string botName = Program.ASF, [CallerMemberName] string previousMethodName = null) {
|
||||
if (string.IsNullOrEmpty(message)) {
|
||||
LogNullError(nameof(message), botName);
|
||||
return;
|
||||
@@ -123,7 +123,7 @@ namespace ArchiSteamFarm {
|
||||
Logger.Error($"{botName}|{previousMethodName}() {message}");
|
||||
}
|
||||
|
||||
internal static void LogGenericException(Exception exception, string botName = "Main", [CallerMemberName] string previousMethodName = null) {
|
||||
internal static void LogGenericException(Exception exception, string botName = Program.ASF, [CallerMemberName] string previousMethodName = null) {
|
||||
if (exception == null) {
|
||||
LogNullError(nameof(exception), botName);
|
||||
return;
|
||||
@@ -132,7 +132,7 @@ namespace ArchiSteamFarm {
|
||||
Logger.Error(exception, $"{botName}|{previousMethodName}()");
|
||||
}
|
||||
|
||||
internal static void LogFatalException(Exception exception, string botName = "Main", [CallerMemberName] string previousMethodName = null) {
|
||||
internal static void LogFatalException(Exception exception, string botName = Program.ASF, [CallerMemberName] string previousMethodName = null) {
|
||||
if (exception == null) {
|
||||
LogNullError(nameof(exception), botName);
|
||||
return;
|
||||
@@ -141,7 +141,7 @@ namespace ArchiSteamFarm {
|
||||
Logger.Fatal(exception, $"{botName}|{previousMethodName}()");
|
||||
}
|
||||
|
||||
internal static void LogGenericWarning(string message, string botName = "Main", [CallerMemberName] string previousMethodName = null) {
|
||||
internal static void LogGenericWarning(string message, string botName = Program.ASF, [CallerMemberName] string previousMethodName = null) {
|
||||
if (string.IsNullOrEmpty(message)) {
|
||||
LogNullError(nameof(message), botName);
|
||||
return;
|
||||
@@ -150,7 +150,7 @@ namespace ArchiSteamFarm {
|
||||
Logger.Warn($"{botName}|{previousMethodName}() {message}");
|
||||
}
|
||||
|
||||
internal static void LogGenericInfo(string message, string botName = "Main", [CallerMemberName] string previousMethodName = null) {
|
||||
internal static void LogGenericInfo(string message, string botName = Program.ASF, [CallerMemberName] string previousMethodName = null) {
|
||||
if (string.IsNullOrEmpty(message)) {
|
||||
LogNullError(nameof(message), botName);
|
||||
return;
|
||||
@@ -160,7 +160,7 @@ namespace ArchiSteamFarm {
|
||||
}
|
||||
|
||||
[SuppressMessage("ReSharper", "ExplicitCallerInfoArgument")]
|
||||
internal static void LogNullError(string nullObjectName, string botName = "Main", [CallerMemberName] string previousMethodName = null) {
|
||||
internal static void LogNullError(string nullObjectName, string botName = Program.ASF, [CallerMemberName] string previousMethodName = null) {
|
||||
if (string.IsNullOrEmpty(nullObjectName)) {
|
||||
return;
|
||||
}
|
||||
@@ -170,7 +170,7 @@ namespace ArchiSteamFarm {
|
||||
|
||||
[Conditional("DEBUG")]
|
||||
[SuppressMessage("ReSharper", "UnusedMember.Global")]
|
||||
internal static void LogGenericDebug(string message, string botName = "Main", [CallerMemberName] string previousMethodName = null) {
|
||||
internal static void LogGenericDebug(string message, string botName = Program.ASF, [CallerMemberName] string previousMethodName = null) {
|
||||
if (string.IsNullOrEmpty(message)) {
|
||||
LogNullError(nameof(message), botName);
|
||||
return;
|
||||
|
||||
@@ -59,11 +59,11 @@ namespace ArchiSteamFarm {
|
||||
Server // Normal + WCF server
|
||||
}
|
||||
|
||||
internal const string ASF = "ASF";
|
||||
internal const string ConfigDirectory = "config";
|
||||
internal const string DebugDirectory = "debug";
|
||||
internal const string LogFile = "log.txt";
|
||||
|
||||
private const string ASF = "ASF";
|
||||
private const string GithubReleaseURL = "https://api.github.com/repos/" + SharedInfo.GithubRepo + "/releases"; // GitHub API is HTTPS only
|
||||
private const string GlobalConfigFile = ASF + ".json";
|
||||
private const string GlobalDatabaseFile = ASF + ".db";
|
||||
@@ -274,7 +274,7 @@ namespace ArchiSteamFarm {
|
||||
Exit();
|
||||
}
|
||||
|
||||
internal static string GetUserInput(EUserInputType userInputType, string botName = "Main", string extraInformation = null) {
|
||||
internal static string GetUserInput(EUserInputType userInputType, string botName = ASF, string extraInformation = null) {
|
||||
if (userInputType == EUserInputType.Unknown) {
|
||||
return null;
|
||||
}
|
||||
@@ -386,7 +386,7 @@ namespace ArchiSteamFarm {
|
||||
WebBrowser.Init();
|
||||
WCF.Init();
|
||||
|
||||
WebBrowser = new WebBrowser("Main");
|
||||
WebBrowser = new WebBrowser(ASF);
|
||||
}
|
||||
|
||||
private static void ParseArgs(IEnumerable<string> args) {
|
||||
@@ -522,7 +522,6 @@ namespace ArchiSteamFarm {
|
||||
foreach (string botName in Directory.EnumerateFiles(ConfigDirectory, "*.json").Select(Path.GetFileNameWithoutExtension)) {
|
||||
switch (botName) {
|
||||
case ASF:
|
||||
case "Main":
|
||||
case "example":
|
||||
case "minimal":
|
||||
continue;
|
||||
|
||||
@@ -60,7 +60,6 @@ namespace ConfigGenerator {
|
||||
string botName = Path.GetFileNameWithoutExtension(configFile);
|
||||
switch (botName) {
|
||||
case Program.ASF:
|
||||
case "Main":
|
||||
case "example":
|
||||
case "minimal":
|
||||
continue;
|
||||
@@ -163,7 +162,6 @@ namespace ConfigGenerator {
|
||||
|
||||
switch (input) {
|
||||
case Program.ASF:
|
||||
case "Main":
|
||||
case "example":
|
||||
case "minimal":
|
||||
Logging.LogGenericErrorWithoutStacktrace("This name is reserved!");
|
||||
|
||||
Reference in New Issue
Block a user