[+] 添加对最新补丁获取异常的跟踪

This commit is contained in:
huiyadanli 2021-06-06 15:38:22 +08:00
parent 06c4ec8c0e
commit 53fbda1f53
3 changed files with 20 additions and 1 deletions

View File

@ -26,7 +26,7 @@ namespace RevokeMsgPatcher
private bool needUpdate = false; private bool needUpdate = false;
private string getPatchJsonStatus = "GETTING"; // GETTING FAIL SUCCESS private string getPatchJsonStatus = "GETTING"; // GETTING FAIL SUCCESS
private GAHelper ga = new GAHelper(); // Google Analytics 记录 private readonly GAHelper ga = GAHelper.Instance; // Google Analytics 记录
public void InitModifier() public void InitModifier()
{ {

View File

@ -17,6 +17,24 @@ namespace RevokeMsgPatcher.Utils
/// </summary> /// </summary>
public class GAHelper public class GAHelper
{ {
private static GAHelper instance = null;
private static readonly object obj = new object();
public static GAHelper Instance
{
get
{
lock (obj)
{
if (instance == null)
{
instance = new GAHelper();
}
return instance;
}
}
}
// 根据实际情况修改 // 根据实际情况修改
private static readonly HttpClient client = HttpUtil.Client; private static readonly HttpClient client = HttpUtil.Client;

View File

@ -39,6 +39,7 @@ namespace RevokeMsgPatcher.Utils
catch (Exception ex) catch (Exception ex)
{ {
Console.WriteLine("第" + (i + 1) + "次请求异常:[" + ex.Message + "]\nURL:" + urls[i]); Console.WriteLine("第" + (i + 1) + "次请求异常:[" + ex.Message + "]\nURL:" + urls[i]);
GAHelper.Instance.RequestPageView($"/main/json/request_ex/{i + 1}/{ex.Message}", "第" + (i + 1) + "次请求异常:[" + ex.Message + "]");
i++; i++;
if (i >= urls.Length) if (i >= urls.Length)
{ {