Add a title to SaveLog

pull/6443/head
2dust 2025-01-03 15:02:31 +08:00
parent 5392766c5e
commit 3db1dd7bbb
27 changed files with 135 additions and 106 deletions

View File

@ -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;

View File

@ -6,6 +6,8 @@ namespace ServiceLib.Common
{
public class JsonUtils
{
private static readonly string _tag = "JsonUtils";
/// <summary>
/// DeepCopy
/// </summary>
@ -90,7 +92,7 @@ namespace ServiceLib.Common
}
catch (Exception ex)
{
Logging.SaveLog(ex.Message, ex);
Logging.SaveLog(_tag, ex);
}
return result;
}

View File

@ -15,6 +15,8 @@ namespace ServiceLib.Common
{
public class Utils
{
private static readonly string _tag = "Utils";
#region 资源操作
/// <summary>
@ -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;

View File

@ -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
{

View File

@ -6,6 +6,8 @@ namespace ServiceLib.Common
{
public class YamlUtils
{
private static readonly string _tag = "YamlUtils";
#region YAML
/// <summary>
@ -26,7 +28,7 @@ namespace ServiceLib.Common
}
catch (Exception ex)
{
Logging.SaveLog("FromYaml", ex);
Logging.SaveLog(_tag, ex);
return deserializer.Deserialize<T>("");
}
}
@ -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;
}
}

View File

@ -5,6 +5,8 @@ namespace ServiceLib.Handler
{
public static class AutoStartupHandler
{
private static readonly string _tag = "AutoStartupHandler";
public static async Task<bool> 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);
}
}

View File

@ -9,6 +9,7 @@ namespace ServiceLib.Handler
private Dictionary<string, ProxiesItem>? _proxies;
public Dictionary<string, object> ProfileContent { get; set; }
private static readonly string _tag = "ClashApiHandler";
public async Task<Tuple<ClashProxies, ClashProviders>?> 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);
}
}

View File

@ -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;

View File

@ -1,10 +1,14 @@
namespace ServiceLib.Handler
using YamlDotNet.Core.Tokens;
namespace ServiceLib.Handler
{
/// <summary>
/// Core configuration file processing class
/// </summary>
public class CoreConfigHandler
{
private static readonly string _tag = "CoreConfigHandler";
public static async Task<RetResult> 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;
}

View File

@ -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;
}

View File

@ -10,6 +10,7 @@ namespace ServiceLib.Handler
private ConcurrentBag<ProfileExItem> _lstProfileEx = [];
private Queue<string> _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);
}
}

View File

@ -12,7 +12,7 @@
private StatisticsXrayService? _statisticsXray;
private StatisticsSingboxService? _statisticsSingbox;
private static readonly string _tag = "StatisticsHandler";
public List<ServerStatItem> ServerStat => _lstServerStat;
public async Task Init(Config config, Action<ServerSpeedItem> 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);
}
}

View File

@ -72,7 +72,6 @@ namespace ServiceLib.Handler.SysProxy
catch (Exception ex)
{
SetProxyFallback(strProxy, exceptions, type);
//Logging.SaveLog(ex.Message, ex);
return false;
}
}

View File

@ -2,6 +2,7 @@
{
public static class SysProxyHandler
{
private static readonly string _tag = "SysProxyHandler";
public static async Task<bool> 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;
}

View File

@ -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<bool> CheckConnection()

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;

View File

@ -13,6 +13,7 @@ namespace ServiceLib.Services
public event EventHandler<RetResult>? UpdateCompleted;
public event ErrorEventHandler? Error;
private static readonly string _tag = "DownloadService";
public async Task<int> DownloadDataAsync(string url, WebProxy webProxy, int downloadTimeout, Action<bool, string> 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;
}
}

View File

@ -11,6 +11,7 @@ namespace ServiceLib.Services
private Action<SpeedTestResult>? _updateFunc;
private bool _exitLoop = false;
private static readonly string _tag = "SpeedtestService";
public SpeedtestService(Config config, List<ProfileItem> selecteds, ESpeedActionType actionType, Action<SpeedTestResult> 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;
}

View File

@ -10,6 +10,7 @@ namespace ServiceLib.Services.Statistics
private ClientWebSocket? webSocket;
private Action<ServerSpeedItem>? _updateFunc;
private string Url => $"ws://{Global.Loopback}:{AppHandler.Instance.StatePort2}/traffic";
private static readonly string _tag = "StatisticsSingboxService";
public StatisticsSingboxService(Config config, Action<ServerSpeedItem> updateFunc)
{
@ -48,7 +49,7 @@ namespace ServiceLib.Services.Statistics
}
catch (Exception ex)
{
Logging.SaveLog(ex.Message, ex);
Logging.SaveLog(_tag, ex);
}
}

View File

@ -7,6 +7,7 @@ namespace ServiceLib.Services
{
private Action<bool, string>? _updateFunc;
private int _timeout = 30;
private static readonly string _tag = "UpdateService";
public async Task CheckUpdateGuiN(Config config, Action<bool, string> 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);
}

View File

@ -279,9 +279,8 @@ namespace ServiceLib.ViewModels
Locator.Current.GetService<ProfilesViewModel>()?.UpdateStatistics(update);
}
}
catch (Exception ex)
catch
{
Logging.SaveLog(ex.Message, ex);
}
}

View File

@ -235,7 +235,7 @@ namespace v2rayN.Desktop.Views
}
catch (Exception ex)
{
Logging.SaveLog("fill fonts error", ex);
Logging.SaveLog("GetFonts", ex);
}
return lstFonts;
}

View File

@ -13,6 +13,7 @@ namespace v2rayN
{
internal static class WindowsUtils
{
private static readonly string _tag = "WindowsUtils";
/// <summary>
/// 获取剪贴板数
/// </summary>
@ -31,7 +32,7 @@ namespace v2rayN
}
catch (Exception ex)
{
Logging.SaveLog(ex.Message, ex);
Logging.SaveLog(_tag, ex);
}
return strData;
}

View File

@ -8,6 +8,7 @@ namespace v2rayN.Handler
{
private static readonly Lazy<WindowsHandler> instance = new(() => new());
public static WindowsHandler Instance => instance.Value;
private static readonly string _tag = "WindowsHandler";
public async Task<Icon> 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;
}
}

View File

@ -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();
}