diff --git a/v2rayN/ServiceLib/Common/FileManager.cs b/v2rayN/ServiceLib/Common/FileManager.cs
index b98b1655..b7bc3a8f 100644
--- a/v2rayN/ServiceLib/Common/FileManager.cs
+++ b/v2rayN/ServiceLib/Common/FileManager.cs
@@ -6,6 +6,8 @@ namespace ServiceLib.Common
{
public static class FileManager
{
+ private static readonly string _tag = "FileManager";
+
public static bool ByteArrayToFile(string fileName, byte[] content)
{
try
@@ -15,7 +17,7 @@ namespace ServiceLib.Common
}
catch (Exception ex)
{
- Logging.SaveLog(ex.Message, ex);
+ Logging.SaveLog(_tag, ex);
}
return false;
}
@@ -30,7 +32,7 @@ namespace ServiceLib.Common
}
catch (Exception ex)
{
- Logging.SaveLog(ex.Message, ex);
+ Logging.SaveLog(_tag, ex);
}
}
@@ -46,7 +48,7 @@ namespace ServiceLib.Common
}
catch (Exception ex)
{
- Logging.SaveLog(ex.Message, ex);
+ Logging.SaveLog(_tag, ex);
}
}
@@ -60,7 +62,7 @@ namespace ServiceLib.Common
}
catch (Exception ex)
{
- Logging.SaveLog(ex.Message, ex);
+ Logging.SaveLog(_tag, ex);
}
}
@@ -79,7 +81,7 @@ namespace ServiceLib.Common
}
catch (Exception ex)
{
- Logging.SaveLog(ex.Message, ex);
+ Logging.SaveLog(_tag, ex);
throw;
}
}
@@ -105,13 +107,13 @@ namespace ServiceLib.Common
}
catch (IOException ex)
{
- Logging.SaveLog(ex.Message, ex);
+ Logging.SaveLog(_tag, ex);
}
}
}
catch (Exception ex)
{
- Logging.SaveLog(ex.Message, ex);
+ Logging.SaveLog(_tag, ex);
return false;
}
return true;
@@ -130,7 +132,7 @@ namespace ServiceLib.Common
}
catch (Exception ex)
{
- Logging.SaveLog(ex.Message, ex);
+ Logging.SaveLog(_tag, ex);
return null;
}
}
@@ -148,7 +150,7 @@ namespace ServiceLib.Common
}
catch (Exception ex)
{
- Logging.SaveLog(ex.Message, ex);
+ Logging.SaveLog(_tag, ex);
return false;
}
return true;
diff --git a/v2rayN/ServiceLib/Common/JsonUtils.cs b/v2rayN/ServiceLib/Common/JsonUtils.cs
index cf5ec25c..09b62dda 100644
--- a/v2rayN/ServiceLib/Common/JsonUtils.cs
+++ b/v2rayN/ServiceLib/Common/JsonUtils.cs
@@ -6,6 +6,8 @@ namespace ServiceLib.Common
{
public class JsonUtils
{
+ private static readonly string _tag = "JsonUtils";
+
///
/// DeepCopy
///
@@ -90,7 +92,7 @@ namespace ServiceLib.Common
}
catch (Exception ex)
{
- Logging.SaveLog(ex.Message, ex);
+ Logging.SaveLog(_tag, ex);
}
return result;
}
diff --git a/v2rayN/ServiceLib/Common/Utils.cs b/v2rayN/ServiceLib/Common/Utils.cs
index 5dd5a4ec..5985fa9f 100644
--- a/v2rayN/ServiceLib/Common/Utils.cs
+++ b/v2rayN/ServiceLib/Common/Utils.cs
@@ -15,6 +15,8 @@ namespace ServiceLib.Common
{
public class Utils
{
+ private static readonly string _tag = "Utils";
+
#region 资源操作
///
@@ -36,7 +38,7 @@ namespace ServiceLib.Common
}
catch (Exception ex)
{
- Logging.SaveLog(ex.Message, ex);
+ Logging.SaveLog(_tag, ex);
}
return result;
@@ -57,7 +59,7 @@ namespace ServiceLib.Common
}
catch (Exception ex)
{
- Logging.SaveLog(ex.Message, ex);
+ Logging.SaveLog(_tag, ex);
}
return null;
@@ -92,7 +94,7 @@ namespace ServiceLib.Common
}
catch (Exception ex)
{
- Logging.SaveLog(ex.Message, ex);
+ Logging.SaveLog(_tag, ex);
}
return string.Empty;
@@ -117,7 +119,7 @@ namespace ServiceLib.Common
}
catch (Exception ex)
{
- Logging.SaveLog(ex.Message, ex);
+ Logging.SaveLog(_tag, ex);
}
return null;
@@ -139,7 +141,7 @@ namespace ServiceLib.Common
}
catch (Exception ex)
{
- Logging.SaveLog(ex.Message, ex);
+ Logging.SaveLog(_tag, ex);
}
return null;
@@ -159,7 +161,7 @@ namespace ServiceLib.Common
}
catch (Exception ex)
{
- Logging.SaveLog("Base64Encode", ex);
+ Logging.SaveLog(_tag, ex);
}
return string.Empty;
@@ -193,7 +195,7 @@ namespace ServiceLib.Common
}
catch (Exception ex)
{
- Logging.SaveLog("Base64Decode", ex);
+ Logging.SaveLog(_tag, ex);
}
return string.Empty;
@@ -483,7 +485,7 @@ namespace ServiceLib.Common
}
catch (Exception ex)
{
- Logging.SaveLog(ex.Message, ex);
+ Logging.SaveLog(_tag, ex);
}
return false;
@@ -535,7 +537,7 @@ namespace ServiceLib.Common
}
catch (Exception ex)
{
- Logging.SaveLog(ex.Message, ex);
+ Logging.SaveLog(_tag, ex);
}
return Global.AppName;
@@ -549,7 +551,7 @@ namespace ServiceLib.Common
}
catch (Exception ex)
{
- Logging.SaveLog(ex.Message, ex);
+ Logging.SaveLog(_tag, ex);
return "0.0";
}
}
@@ -578,7 +580,7 @@ namespace ServiceLib.Common
}
catch (Exception ex)
{
- Logging.SaveLog(ex.Message, ex);
+ Logging.SaveLog(_tag, ex);
}
return string.Empty;
@@ -605,7 +607,7 @@ namespace ServiceLib.Common
}
catch (Exception ex)
{
- Logging.SaveLog(ex.Message, ex);
+ Logging.SaveLog(_tag, ex);
}
}
@@ -631,7 +633,7 @@ namespace ServiceLib.Common
}
catch (Exception ex)
{
- Logging.SaveLog(ex.Message, ex);
+ Logging.SaveLog(_tag, ex);
}
return systemHosts;
diff --git a/v2rayN/ServiceLib/Common/WindowsUtils.cs b/v2rayN/ServiceLib/Common/WindowsUtils.cs
index a7b8fc5f..94b3b811 100644
--- a/v2rayN/ServiceLib/Common/WindowsUtils.cs
+++ b/v2rayN/ServiceLib/Common/WindowsUtils.cs
@@ -4,6 +4,7 @@ namespace ServiceLib.Common
{
internal static class WindowsUtils
{
+ private static readonly string _tag = "WindowsUtils";
public static string? RegReadValue(string path, string name, string def)
{
RegistryKey? regKey = null;
@@ -15,7 +16,7 @@ namespace ServiceLib.Common
}
catch (Exception ex)
{
- Logging.SaveLog(ex.Message, ex);
+ Logging.SaveLog(_tag, ex);
}
finally
{
@@ -41,7 +42,7 @@ namespace ServiceLib.Common
}
catch (Exception ex)
{
- Logging.SaveLog(ex.Message, ex);
+ Logging.SaveLog(_tag, ex);
}
finally
{
diff --git a/v2rayN/ServiceLib/Common/YamlUtils.cs b/v2rayN/ServiceLib/Common/YamlUtils.cs
index 94d572b5..13ad2d78 100644
--- a/v2rayN/ServiceLib/Common/YamlUtils.cs
+++ b/v2rayN/ServiceLib/Common/YamlUtils.cs
@@ -6,6 +6,8 @@ namespace ServiceLib.Common
{
public class YamlUtils
{
+ private static readonly string _tag = "YamlUtils";
+
#region YAML
///
@@ -26,7 +28,7 @@ namespace ServiceLib.Common
}
catch (Exception ex)
{
- Logging.SaveLog("FromYaml", ex);
+ Logging.SaveLog(_tag, ex);
return deserializer.Deserialize("");
}
}
@@ -53,7 +55,7 @@ namespace ServiceLib.Common
}
catch (Exception ex)
{
- Logging.SaveLog(ex.Message, ex);
+ Logging.SaveLog(_tag, ex);
}
return result;
}
@@ -71,7 +73,7 @@ namespace ServiceLib.Common
}
catch (Exception ex)
{
- Logging.SaveLog("PreprocessYaml", ex);
+ Logging.SaveLog(_tag, ex);
return null;
}
}
diff --git a/v2rayN/ServiceLib/Handler/AutoStartupHandler.cs b/v2rayN/ServiceLib/Handler/AutoStartupHandler.cs
index 12dc2921..881532fc 100644
--- a/v2rayN/ServiceLib/Handler/AutoStartupHandler.cs
+++ b/v2rayN/ServiceLib/Handler/AutoStartupHandler.cs
@@ -5,6 +5,8 @@ namespace ServiceLib.Handler
{
public static class AutoStartupHandler
{
+ private static readonly string _tag = "AutoStartupHandler";
+
public static async Task UpdateTask(Config config)
{
if (Utils.IsWindows())
@@ -62,7 +64,7 @@ namespace ServiceLib.Handler
}
catch (Exception ex)
{
- Logging.SaveLog(ex.Message, ex);
+ Logging.SaveLog(_tag, ex);
}
}
@@ -123,7 +125,7 @@ namespace ServiceLib.Handler
}
catch (Exception ex)
{
- Logging.SaveLog(ex.Message, ex);
+ Logging.SaveLog(_tag, ex);
}
}
@@ -143,7 +145,7 @@ namespace ServiceLib.Handler
}
catch (Exception ex)
{
- Logging.SaveLog(ex.Message, ex);
+ Logging.SaveLog(_tag, ex);
}
}
diff --git a/v2rayN/ServiceLib/Handler/ClashApiHandler.cs b/v2rayN/ServiceLib/Handler/ClashApiHandler.cs
index cae3c035..81d92b04 100644
--- a/v2rayN/ServiceLib/Handler/ClashApiHandler.cs
+++ b/v2rayN/ServiceLib/Handler/ClashApiHandler.cs
@@ -9,6 +9,7 @@ namespace ServiceLib.Handler
private Dictionary? _proxies;
public Dictionary ProfileContent { get; set; }
+ private static readonly string _tag = "ClashApiHandler";
public async Task?> GetClashProxiesAsync(Config config)
{
@@ -109,7 +110,7 @@ namespace ServiceLib.Handler
}
catch (Exception ex)
{
- Logging.SaveLog("GetClashProxyGroups", ex);
+ Logging.SaveLog(_tag, ex);
return null;
}
}
@@ -125,7 +126,7 @@ namespace ServiceLib.Handler
}
catch (Exception ex)
{
- Logging.SaveLog(ex.Message, ex);
+ Logging.SaveLog(_tag, ex);
}
}
@@ -153,7 +154,7 @@ namespace ServiceLib.Handler
}
catch (Exception ex)
{
- Logging.SaveLog(ex.Message, ex);
+ Logging.SaveLog(_tag, ex);
}
}
@@ -169,7 +170,7 @@ namespace ServiceLib.Handler
}
catch (Exception ex)
{
- Logging.SaveLog(ex.Message, ex);
+ Logging.SaveLog(_tag, ex);
}
return null;
@@ -184,7 +185,7 @@ namespace ServiceLib.Handler
}
catch (Exception ex)
{
- Logging.SaveLog(ex.Message, ex);
+ Logging.SaveLog(_tag, ex);
}
}
diff --git a/v2rayN/ServiceLib/Handler/ConfigHandler.cs b/v2rayN/ServiceLib/Handler/ConfigHandler.cs
index c1ff96ca..fea4b3f4 100644
--- a/v2rayN/ServiceLib/Handler/ConfigHandler.cs
+++ b/v2rayN/ServiceLib/Handler/ConfigHandler.cs
@@ -9,6 +9,7 @@ namespace ServiceLib.Handler
public class ConfigHandler
{
private static readonly string _configRes = Global.ConfigFileName;
+ private static readonly string _tag = "ConfigHandler";
#region ConfigHandler
@@ -194,7 +195,7 @@ namespace ServiceLib.Handler
}
catch (Exception ex)
{
- Logging.SaveLog("ToJsonFile", ex);
+ Logging.SaveLog(_tag, ex);
return -1;
}
@@ -500,7 +501,7 @@ namespace ServiceLib.Handler
}
catch (Exception ex)
{
- Logging.SaveLog(ex.Message, ex);
+ Logging.SaveLog(_tag, ex);
return -1;
}
@@ -987,7 +988,7 @@ namespace ServiceLib.Handler
}
catch (Exception ex)
{
- Logging.SaveLog("Remove Item", ex);
+ Logging.SaveLog(_tag, ex);
}
return 0;
diff --git a/v2rayN/ServiceLib/Handler/CoreConfigHandler.cs b/v2rayN/ServiceLib/Handler/CoreConfigHandler.cs
index 84c694c6..a034712d 100644
--- a/v2rayN/ServiceLib/Handler/CoreConfigHandler.cs
+++ b/v2rayN/ServiceLib/Handler/CoreConfigHandler.cs
@@ -1,10 +1,14 @@
-namespace ServiceLib.Handler
+using YamlDotNet.Core.Tokens;
+
+namespace ServiceLib.Handler
{
///
/// Core configuration file processing class
///
public class CoreConfigHandler
{
+ private static readonly string _tag = "CoreConfigHandler";
+
public static async Task GenerateClientConfig(ProfileItem node, string? fileName)
{
var config = AppHandler.Instance.Config;
@@ -82,7 +86,7 @@
}
catch (Exception ex)
{
- Logging.SaveLog("GenerateClientCustomConfig", ex);
+ Logging.SaveLog(_tag, ex);
ret.Msg = ResUI.FailedGenDefaultConfiguration;
return ret;
}
diff --git a/v2rayN/ServiceLib/Handler/Fmt/FmtHandler.cs b/v2rayN/ServiceLib/Handler/Fmt/FmtHandler.cs
index 4e95b129..1830c8af 100644
--- a/v2rayN/ServiceLib/Handler/Fmt/FmtHandler.cs
+++ b/v2rayN/ServiceLib/Handler/Fmt/FmtHandler.cs
@@ -2,6 +2,8 @@
{
public class FmtHandler
{
+ private static readonly string _tag = "FmtHandler";
+
public static string? GetShareUri(ProfileItem item)
{
try
@@ -23,7 +25,7 @@
}
catch (Exception ex)
{
- Logging.SaveLog(ex.Message, ex);
+ Logging.SaveLog(_tag, ex);
return "";
}
}
@@ -81,7 +83,7 @@
}
catch (Exception ex)
{
- Logging.SaveLog(ex.Message, ex);
+ Logging.SaveLog(_tag, ex);
msg = ResUI.Incorrectconfiguration;
return null;
}
diff --git a/v2rayN/ServiceLib/Handler/ProfileExHandler.cs b/v2rayN/ServiceLib/Handler/ProfileExHandler.cs
index 1eee7558..b630171f 100644
--- a/v2rayN/ServiceLib/Handler/ProfileExHandler.cs
+++ b/v2rayN/ServiceLib/Handler/ProfileExHandler.cs
@@ -10,6 +10,7 @@ namespace ServiceLib.Handler
private ConcurrentBag _lstProfileEx = [];
private Queue _queIndexIds = new();
public static ProfileExHandler Instance => _instance.Value;
+ private static readonly string _tag = "ProfileExHandler";
public ProfileExHandler()
{
@@ -87,7 +88,7 @@ namespace ServiceLib.Handler
}
catch (Exception ex)
{
- Logging.SaveLog("ProfileExHandler", ex);
+ Logging.SaveLog(_tag, ex);
}
}
}
@@ -119,7 +120,7 @@ namespace ServiceLib.Handler
}
catch (Exception ex)
{
- Logging.SaveLog(ex.Message, ex);
+ Logging.SaveLog(_tag, ex);
}
}
diff --git a/v2rayN/ServiceLib/Handler/StatisticsHandler.cs b/v2rayN/ServiceLib/Handler/StatisticsHandler.cs
index 1858780e..b5aabe7a 100644
--- a/v2rayN/ServiceLib/Handler/StatisticsHandler.cs
+++ b/v2rayN/ServiceLib/Handler/StatisticsHandler.cs
@@ -12,7 +12,7 @@
private StatisticsXrayService? _statisticsXray;
private StatisticsSingboxService? _statisticsSingbox;
-
+ private static readonly string _tag = "StatisticsHandler";
public List ServerStat => _lstServerStat;
public async Task Init(Config config, Action updateFunc)
@@ -39,7 +39,7 @@
}
catch (Exception ex)
{
- Logging.SaveLog(ex.Message, ex);
+ Logging.SaveLog(_tag, ex);
}
}
@@ -61,7 +61,7 @@
}
catch (Exception ex)
{
- Logging.SaveLog(ex.Message, ex);
+ Logging.SaveLog(_tag, ex);
}
}
diff --git a/v2rayN/ServiceLib/Handler/SysProxy/ProxySettingWindows.cs b/v2rayN/ServiceLib/Handler/SysProxy/ProxySettingWindows.cs
index 2662f959..8d6dbc13 100644
--- a/v2rayN/ServiceLib/Handler/SysProxy/ProxySettingWindows.cs
+++ b/v2rayN/ServiceLib/Handler/SysProxy/ProxySettingWindows.cs
@@ -72,7 +72,6 @@ namespace ServiceLib.Handler.SysProxy
catch (Exception ex)
{
SetProxyFallback(strProxy, exceptions, type);
- //Logging.SaveLog(ex.Message, ex);
return false;
}
}
diff --git a/v2rayN/ServiceLib/Handler/SysProxy/SysProxyHandler.cs b/v2rayN/ServiceLib/Handler/SysProxy/SysProxyHandler.cs
index 3275b6d0..7aceb5fd 100644
--- a/v2rayN/ServiceLib/Handler/SysProxy/SysProxyHandler.cs
+++ b/v2rayN/ServiceLib/Handler/SysProxy/SysProxyHandler.cs
@@ -2,6 +2,7 @@
{
public static class SysProxyHandler
{
+ private static readonly string _tag = "SysProxyHandler";
public static async Task UpdateSysProxy(Config config, bool forceDisable)
{
var type = config.SystemProxyItem.SysProxyType;
@@ -59,7 +60,7 @@
}
catch (Exception ex)
{
- Logging.SaveLog(ex.Message, ex);
+ Logging.SaveLog(_tag, ex);
}
return true;
}
diff --git a/v2rayN/ServiceLib/Handler/WebDavHandler.cs b/v2rayN/ServiceLib/Handler/WebDavHandler.cs
index c034d06f..4deed956 100644
--- a/v2rayN/ServiceLib/Handler/WebDavHandler.cs
+++ b/v2rayN/ServiceLib/Handler/WebDavHandler.cs
@@ -13,7 +13,8 @@ namespace ServiceLib.Handler
private string? _lastDescription;
private string _webDir = Global.AppName + "_backup";
private readonly string _webFileName = "backup.zip";
- private string _logTitle = "WebDav--";
+ private readonly string _tag = "WebDav--";
+
public WebDavHandler()
{
@@ -81,13 +82,13 @@ namespace ServiceLib.Handler
private void SaveLog(string desc)
{
_lastDescription = desc;
- Logging.SaveLog(_logTitle + desc);
+ Logging.SaveLog(_tag + desc);
}
private void SaveLog(Exception ex)
{
_lastDescription = ex.Message;
- Logging.SaveLog(_logTitle, ex);
+ Logging.SaveLog(_tag, ex);
}
public async Task CheckConnection()
diff --git a/v2rayN/ServiceLib/Services/CoreConfig/CoreConfigClashService.cs b/v2rayN/ServiceLib/Services/CoreConfig/CoreConfigClashService.cs
index e48f3a5f..2a732e2b 100644
--- a/v2rayN/ServiceLib/Services/CoreConfig/CoreConfigClashService.cs
+++ b/v2rayN/ServiceLib/Services/CoreConfig/CoreConfigClashService.cs
@@ -6,6 +6,7 @@ namespace ServiceLib.Services.CoreConfig
public class CoreConfigClashService
{
private Config _config;
+ private static readonly string _tag = "CoreConfigClashService";
public CoreConfigClashService(Config config)
{
@@ -131,7 +132,7 @@ namespace ServiceLib.Services.CoreConfig
}
catch (Exception ex)
{
- Logging.SaveLog("GenerateClientConfigClash-Mixin", ex);
+ Logging.SaveLog($"{_tag}-Mixin", ex);
}
var txtFileNew = YamlUtils.ToYaml(fileContent).Replace(tagYamlStr2, tagYamlStr3);
@@ -151,7 +152,7 @@ namespace ServiceLib.Services.CoreConfig
}
catch (Exception ex)
{
- Logging.SaveLog("GenerateClientConfigClash", ex);
+ Logging.SaveLog(_tag, ex);
ret.Msg = ResUI.FailedGenDefaultConfiguration;
return ret;
}
diff --git a/v2rayN/ServiceLib/Services/CoreConfig/CoreConfigSingboxService.cs b/v2rayN/ServiceLib/Services/CoreConfig/CoreConfigSingboxService.cs
index b1a907d2..91d17d44 100644
--- a/v2rayN/ServiceLib/Services/CoreConfig/CoreConfigSingboxService.cs
+++ b/v2rayN/ServiceLib/Services/CoreConfig/CoreConfigSingboxService.cs
@@ -7,6 +7,7 @@ namespace ServiceLib.Services.CoreConfig
public class CoreConfigSingboxService
{
private Config _config;
+ private static readonly string _tag = "CoreConfigSingboxService";
public CoreConfigSingboxService(Config config)
{
@@ -71,7 +72,7 @@ namespace ServiceLib.Services.CoreConfig
}
catch (Exception ex)
{
- Logging.SaveLog("GenerateClientConfig4Singbox", ex);
+ Logging.SaveLog(_tag, ex);
ret.Msg = ResUI.FailedGenDefaultConfiguration;
return ret;
}
@@ -114,7 +115,7 @@ namespace ServiceLib.Services.CoreConfig
}
catch (Exception ex)
{
- Logging.SaveLog(ex.Message, ex);
+ Logging.SaveLog(_tag, ex);
}
await GenLog(singboxConfig);
@@ -235,7 +236,7 @@ namespace ServiceLib.Services.CoreConfig
}
catch (Exception ex)
{
- Logging.SaveLog(ex.Message, ex);
+ Logging.SaveLog(_tag, ex);
ret.Msg = ResUI.FailedGenDefaultConfiguration;
return ret;
}
@@ -351,7 +352,7 @@ namespace ServiceLib.Services.CoreConfig
}
catch (Exception ex)
{
- Logging.SaveLog(ex.Message, ex);
+ Logging.SaveLog(_tag, ex);
ret.Msg = ResUI.FailedGenDefaultConfiguration;
return ret;
}
@@ -432,7 +433,7 @@ namespace ServiceLib.Services.CoreConfig
}
catch (Exception ex)
{
- Logging.SaveLog(ex.Message, ex);
+ Logging.SaveLog(_tag, ex);
ret.Msg = ResUI.FailedGenDefaultConfiguration;
return ret;
}
@@ -473,7 +474,7 @@ namespace ServiceLib.Services.CoreConfig
}
catch (Exception ex)
{
- Logging.SaveLog(ex.Message, ex);
+ Logging.SaveLog(_tag, ex);
}
return 0;
}
@@ -562,7 +563,7 @@ namespace ServiceLib.Services.CoreConfig
}
catch (Exception ex)
{
- Logging.SaveLog(ex.Message, ex);
+ Logging.SaveLog(_tag, ex);
}
return 0;
}
@@ -695,7 +696,7 @@ namespace ServiceLib.Services.CoreConfig
}
catch (Exception ex)
{
- Logging.SaveLog(ex.Message, ex);
+ Logging.SaveLog(_tag, ex);
}
return 0;
}
@@ -718,7 +719,7 @@ namespace ServiceLib.Services.CoreConfig
}
catch (Exception ex)
{
- Logging.SaveLog(ex.Message, ex);
+ Logging.SaveLog(_tag, ex);
}
return 0;
}
@@ -768,7 +769,7 @@ namespace ServiceLib.Services.CoreConfig
}
catch (Exception ex)
{
- Logging.SaveLog(ex.Message, ex);
+ Logging.SaveLog(_tag, ex);
}
return 0;
}
@@ -845,7 +846,7 @@ namespace ServiceLib.Services.CoreConfig
}
catch (Exception ex)
{
- Logging.SaveLog(ex.Message, ex);
+ Logging.SaveLog(_tag, ex);
}
return 0;
}
@@ -897,7 +898,7 @@ namespace ServiceLib.Services.CoreConfig
}
catch (Exception ex)
{
- Logging.SaveLog(ex.Message, ex);
+ Logging.SaveLog(_tag, ex);
}
return 0;
@@ -969,7 +970,7 @@ namespace ServiceLib.Services.CoreConfig
}
catch (Exception ex)
{
- Logging.SaveLog(ex.Message, ex);
+ Logging.SaveLog(_tag, ex);
}
return 0;
}
@@ -1085,7 +1086,7 @@ namespace ServiceLib.Services.CoreConfig
}
catch (Exception ex)
{
- Logging.SaveLog(ex.Message, ex);
+ Logging.SaveLog(_tag, ex);
}
return 0;
}
@@ -1184,7 +1185,7 @@ namespace ServiceLib.Services.CoreConfig
}
catch (Exception ex)
{
- Logging.SaveLog(ex.Message, ex);
+ Logging.SaveLog(_tag, ex);
}
return 0;
}
diff --git a/v2rayN/ServiceLib/Services/CoreConfig/CoreConfigV2rayService.cs b/v2rayN/ServiceLib/Services/CoreConfig/CoreConfigV2rayService.cs
index e54eebc1..8f71460a 100644
--- a/v2rayN/ServiceLib/Services/CoreConfig/CoreConfigV2rayService.cs
+++ b/v2rayN/ServiceLib/Services/CoreConfig/CoreConfigV2rayService.cs
@@ -7,6 +7,7 @@ namespace ServiceLib.Services.CoreConfig
public class CoreConfigV2rayService
{
private Config _config;
+ private static readonly string _tag = "CoreConfigV2rayService";
public CoreConfigV2rayService(Config config)
{
@@ -70,7 +71,7 @@ namespace ServiceLib.Services.CoreConfig
}
catch (Exception ex)
{
- Logging.SaveLog("GenerateClientConfig4V2ray", ex);
+ Logging.SaveLog(_tag, ex);
ret.Msg = ResUI.FailedGenDefaultConfiguration;
return ret;
}
@@ -197,7 +198,7 @@ namespace ServiceLib.Services.CoreConfig
}
catch (Exception ex)
{
- Logging.SaveLog(ex.Message, ex);
+ Logging.SaveLog(_tag, ex);
ret.Msg = ResUI.FailedGenDefaultConfiguration;
return ret;
}
@@ -240,7 +241,7 @@ namespace ServiceLib.Services.CoreConfig
}
catch (Exception ex)
{
- Logging.SaveLog(ex.Message, ex);
+ Logging.SaveLog(_tag, ex);
}
await GenLog(v2rayConfig);
@@ -349,7 +350,7 @@ namespace ServiceLib.Services.CoreConfig
}
catch (Exception ex)
{
- Logging.SaveLog(ex.Message, ex);
+ Logging.SaveLog(_tag, ex);
ret.Msg = ResUI.FailedGenDefaultConfiguration;
return ret;
}
@@ -379,7 +380,7 @@ namespace ServiceLib.Services.CoreConfig
}
catch (Exception ex)
{
- Logging.SaveLog(ex.Message, ex);
+ Logging.SaveLog(_tag, ex);
}
return 0;
}
@@ -423,7 +424,7 @@ namespace ServiceLib.Services.CoreConfig
}
catch (Exception ex)
{
- Logging.SaveLog(ex.Message, ex);
+ Logging.SaveLog(_tag, ex);
}
return 0;
}
@@ -482,7 +483,7 @@ namespace ServiceLib.Services.CoreConfig
}
catch (Exception ex)
{
- Logging.SaveLog(ex.Message, ex);
+ Logging.SaveLog(_tag, ex);
}
return 0;
}
@@ -560,7 +561,7 @@ namespace ServiceLib.Services.CoreConfig
}
catch (Exception ex)
{
- Logging.SaveLog(ex.Message, ex);
+ Logging.SaveLog(_tag, ex);
}
return 0;
}
@@ -754,7 +755,7 @@ namespace ServiceLib.Services.CoreConfig
}
catch (Exception ex)
{
- Logging.SaveLog(ex.Message, ex);
+ Logging.SaveLog(_tag, ex);
}
return 0;
}
@@ -778,7 +779,7 @@ namespace ServiceLib.Services.CoreConfig
}
catch (Exception ex)
{
- Logging.SaveLog(ex.Message, ex);
+ Logging.SaveLog(_tag, ex);
}
return 0;
}
@@ -1020,7 +1021,7 @@ namespace ServiceLib.Services.CoreConfig
}
catch (Exception ex)
{
- Logging.SaveLog(ex.Message, ex);
+ Logging.SaveLog(_tag, ex);
}
return 0;
}
@@ -1083,7 +1084,7 @@ namespace ServiceLib.Services.CoreConfig
}
catch (Exception ex)
{
- Logging.SaveLog(ex.Message, ex);
+ Logging.SaveLog(_tag, ex);
}
return 0;
}
@@ -1241,7 +1242,7 @@ namespace ServiceLib.Services.CoreConfig
}
catch (Exception ex)
{
- Logging.SaveLog(ex.Message, ex);
+ Logging.SaveLog(_tag, ex);
}
return 0;
diff --git a/v2rayN/ServiceLib/Services/DownloadService.cs b/v2rayN/ServiceLib/Services/DownloadService.cs
index 5801e532..e420ce78 100644
--- a/v2rayN/ServiceLib/Services/DownloadService.cs
+++ b/v2rayN/ServiceLib/Services/DownloadService.cs
@@ -13,6 +13,7 @@ namespace ServiceLib.Services
public event EventHandler? UpdateCompleted;
public event ErrorEventHandler? Error;
+ private static readonly string _tag = "DownloadService";
public async Task DownloadDataAsync(string url, WebProxy webProxy, int downloadTimeout, Action updateFunc)
{
@@ -68,7 +69,7 @@ namespace ServiceLib.Services
}
catch (Exception ex)
{
- Logging.SaveLog(ex.Message, ex);
+ Logging.SaveLog(_tag, ex);
Error?.Invoke(this, new ErrorEventArgs(ex));
if (ex.InnerException != null)
@@ -113,7 +114,7 @@ namespace ServiceLib.Services
}
catch (Exception ex)
{
- Logging.SaveLog(ex.Message, ex);
+ Logging.SaveLog(_tag, ex);
Error?.Invoke(this, new ErrorEventArgs(ex));
if (ex.InnerException != null)
{
@@ -131,7 +132,7 @@ namespace ServiceLib.Services
}
catch (Exception ex)
{
- Logging.SaveLog(ex.Message, ex);
+ Logging.SaveLog(_tag, ex);
Error?.Invoke(this, new ErrorEventArgs(ex));
if (ex.InnerException != null)
{
@@ -177,7 +178,7 @@ namespace ServiceLib.Services
}
catch (Exception ex)
{
- Logging.SaveLog(ex.Message, ex);
+ Logging.SaveLog(_tag, ex);
Error?.Invoke(this, new ErrorEventArgs(ex));
if (ex.InnerException != null)
{
@@ -208,7 +209,7 @@ namespace ServiceLib.Services
}
catch (Exception ex)
{
- Logging.SaveLog(ex.Message, ex);
+ Logging.SaveLog(_tag, ex);
Error?.Invoke(this, new ErrorEventArgs(ex));
if (ex.InnerException != null)
{
@@ -232,13 +233,13 @@ namespace ServiceLib.Services
}
catch (Exception ex)
{
- Logging.SaveLog(ex.Message, ex);
+ Logging.SaveLog(_tag, ex);
return -1;
}
}
catch (Exception ex)
{
- Logging.SaveLog(ex.Message, ex);
+ Logging.SaveLog(_tag, ex);
return -1;
}
}
diff --git a/v2rayN/ServiceLib/Services/SpeedtestService.cs b/v2rayN/ServiceLib/Services/SpeedtestService.cs
index 928fb0ee..05a5ffd7 100644
--- a/v2rayN/ServiceLib/Services/SpeedtestService.cs
+++ b/v2rayN/ServiceLib/Services/SpeedtestService.cs
@@ -11,6 +11,7 @@ namespace ServiceLib.Services
private Action? _updateFunc;
private bool _exitLoop = false;
+ private static readonly string _tag = "SpeedtestService";
public SpeedtestService(Config config, List selecteds, ESpeedActionType actionType, Action updateFunc)
{
@@ -146,7 +147,7 @@ namespace ServiceLib.Services
}
catch (Exception ex)
{
- Logging.SaveLog(ex.Message, ex);
+ Logging.SaveLog(_tag, ex);
}
}));
}
@@ -154,7 +155,7 @@ namespace ServiceLib.Services
}
catch (Exception ex)
{
- Logging.SaveLog(ex.Message, ex);
+ Logging.SaveLog(_tag, ex);
}
finally
{
@@ -201,7 +202,7 @@ namespace ServiceLib.Services
}
catch (Exception ex)
{
- Logging.SaveLog(ex.Message, ex);
+ Logging.SaveLog(_tag, ex);
}
}));
}
@@ -209,7 +210,7 @@ namespace ServiceLib.Services
}
catch (Exception ex)
{
- Logging.SaveLog(ex.Message, ex);
+ Logging.SaveLog(_tag, ex);
}
finally
{
@@ -389,7 +390,7 @@ namespace ServiceLib.Services
}
catch (Exception ex)
{
- Logging.SaveLog(ex.Message, ex);
+ Logging.SaveLog(_tag, ex);
}
return responseTime;
}
diff --git a/v2rayN/ServiceLib/Services/Statistics/StatisticsSingboxService.cs b/v2rayN/ServiceLib/Services/Statistics/StatisticsSingboxService.cs
index ef70e3f7..2b5a737a 100644
--- a/v2rayN/ServiceLib/Services/Statistics/StatisticsSingboxService.cs
+++ b/v2rayN/ServiceLib/Services/Statistics/StatisticsSingboxService.cs
@@ -10,6 +10,7 @@ namespace ServiceLib.Services.Statistics
private ClientWebSocket? webSocket;
private Action? _updateFunc;
private string Url => $"ws://{Global.Loopback}:{AppHandler.Instance.StatePort2}/traffic";
+ private static readonly string _tag = "StatisticsSingboxService";
public StatisticsSingboxService(Config config, Action updateFunc)
{
@@ -48,7 +49,7 @@ namespace ServiceLib.Services.Statistics
}
catch (Exception ex)
{
- Logging.SaveLog(ex.Message, ex);
+ Logging.SaveLog(_tag, ex);
}
}
diff --git a/v2rayN/ServiceLib/Services/UpdateService.cs b/v2rayN/ServiceLib/Services/UpdateService.cs
index bd0f6a2b..d737459c 100644
--- a/v2rayN/ServiceLib/Services/UpdateService.cs
+++ b/v2rayN/ServiceLib/Services/UpdateService.cs
@@ -7,6 +7,7 @@ namespace ServiceLib.Services
{
private Action? _updateFunc;
private int _timeout = 30;
+ private static readonly string _tag = "UpdateService";
public async Task CheckUpdateGuiN(Config config, Action updateFunc, bool preRelease)
{
@@ -272,7 +273,7 @@ namespace ServiceLib.Services
}
catch (Exception ex)
{
- Logging.SaveLog(ex.Message, ex);
+ Logging.SaveLog(_tag, ex);
_updateFunc?.Invoke(false, ex.Message);
return new RetResult(false, ex.Message);
}
@@ -356,7 +357,7 @@ namespace ServiceLib.Services
}
catch (Exception ex)
{
- Logging.SaveLog(ex.Message, ex);
+ Logging.SaveLog(_tag, ex);
_updateFunc?.Invoke(false, ex.Message);
return new SemanticVersion("");
}
@@ -415,7 +416,7 @@ namespace ServiceLib.Services
}
catch (Exception ex)
{
- Logging.SaveLog(ex.Message, ex);
+ Logging.SaveLog(_tag, ex);
_updateFunc?.Invoke(false, ex.Message);
return new RetResult(false, ex.Message);
}
diff --git a/v2rayN/ServiceLib/ViewModels/MainWindowViewModel.cs b/v2rayN/ServiceLib/ViewModels/MainWindowViewModel.cs
index cd1c2d13..e8def23f 100644
--- a/v2rayN/ServiceLib/ViewModels/MainWindowViewModel.cs
+++ b/v2rayN/ServiceLib/ViewModels/MainWindowViewModel.cs
@@ -279,9 +279,8 @@ namespace ServiceLib.ViewModels
Locator.Current.GetService()?.UpdateStatistics(update);
}
}
- catch (Exception ex)
+ catch
{
- Logging.SaveLog(ex.Message, ex);
}
}
diff --git a/v2rayN/v2rayN.Desktop/Views/OptionSettingWindow.axaml.cs b/v2rayN/v2rayN.Desktop/Views/OptionSettingWindow.axaml.cs
index 26251bf1..f4a583d6 100644
--- a/v2rayN/v2rayN.Desktop/Views/OptionSettingWindow.axaml.cs
+++ b/v2rayN/v2rayN.Desktop/Views/OptionSettingWindow.axaml.cs
@@ -235,7 +235,7 @@ namespace v2rayN.Desktop.Views
}
catch (Exception ex)
{
- Logging.SaveLog("fill fonts error", ex);
+ Logging.SaveLog("GetFonts", ex);
}
return lstFonts;
}
diff --git a/v2rayN/v2rayN/Common/WindowsUtils.cs b/v2rayN/v2rayN/Common/WindowsUtils.cs
index fdb9be0c..d07920f3 100644
--- a/v2rayN/v2rayN/Common/WindowsUtils.cs
+++ b/v2rayN/v2rayN/Common/WindowsUtils.cs
@@ -13,6 +13,7 @@ namespace v2rayN
{
internal static class WindowsUtils
{
+ private static readonly string _tag = "WindowsUtils";
///
/// 获取剪贴板数
///
@@ -31,7 +32,7 @@ namespace v2rayN
}
catch (Exception ex)
{
- Logging.SaveLog(ex.Message, ex);
+ Logging.SaveLog(_tag, ex);
}
return strData;
}
diff --git a/v2rayN/v2rayN/Handler/WindowsHandler.cs b/v2rayN/v2rayN/Handler/WindowsHandler.cs
index ddc7d2f3..95404085 100644
--- a/v2rayN/v2rayN/Handler/WindowsHandler.cs
+++ b/v2rayN/v2rayN/Handler/WindowsHandler.cs
@@ -8,6 +8,7 @@ namespace v2rayN.Handler
{
private static readonly Lazy instance = new(() => new());
public static WindowsHandler Instance => instance.Value;
+ private static readonly string _tag = "WindowsHandler";
public async Task GetNotifyIcon(Config config)
{
@@ -39,7 +40,7 @@ namespace v2rayN.Handler
}
catch (Exception ex)
{
- Logging.SaveLog(ex.Message, ex);
+ Logging.SaveLog(_tag, ex);
return Properties.Resources.NotifyIcon1;
}
}
@@ -89,7 +90,7 @@ namespace v2rayN.Handler
}
catch (Exception ex)
{
- Logging.SaveLog(ex.Message, ex);
+ Logging.SaveLog(_tag, ex);
return null;
}
}
diff --git a/v2rayN/v2rayN/Views/OptionSettingWindow.xaml.cs b/v2rayN/v2rayN/Views/OptionSettingWindow.xaml.cs
index 9302c0d0..d1c859d5 100644
--- a/v2rayN/v2rayN/Views/OptionSettingWindow.xaml.cs
+++ b/v2rayN/v2rayN/Views/OptionSettingWindow.xaml.cs
@@ -246,7 +246,7 @@ namespace v2rayN.Views
}
catch (Exception ex)
{
- Logging.SaveLog("fill fonts error", ex);
+ Logging.SaveLog("GetFonts", ex);
}
return lstFonts.OrderBy(t => t).ToList();
}