mirror of
https://github.com/MaaAssistantArknights/MaaAssistantArknights.git
synced 2026-07-16 17:57:01 +08:00
chore: response.Log 添加 etag 日志
This commit is contained in:
@@ -12,6 +12,7 @@
|
||||
// </copyright>
|
||||
|
||||
using System;
|
||||
using System.Net;
|
||||
using System.Net.Http;
|
||||
using Serilog;
|
||||
|
||||
@@ -26,14 +27,15 @@ namespace MaaWpfGui.Extensions
|
||||
var method = response?.RequestMessage?.Method;
|
||||
var uri = response?.RequestMessage?.RequestUri;
|
||||
var statusCode = response?.StatusCode.ToString();
|
||||
var etag = response?.Headers.ETag?.Tag;
|
||||
|
||||
if (response is { IsSuccessStatusCode: true })
|
||||
if (response != null && (response.IsSuccessStatusCode || response.StatusCode == HttpStatusCode.NotModified))
|
||||
{
|
||||
_logger.Information("HTTP: {StatusCode} {Method} {Url}", statusCode, method, uri?.GetLeftPart(uriPartial));
|
||||
_logger.Information("HTTP: {StatusCode} {Method} {Url} {Etag}", statusCode, method, uri?.GetLeftPart(uriPartial), etag);
|
||||
}
|
||||
else
|
||||
{
|
||||
_logger.Warning("HTTP: {StatusCode} {Method} {Url}", statusCode, method, uri?.GetLeftPart(uriPartial));
|
||||
_logger.Warning("HTTP: {StatusCode} {Method} {Url} {Etag}", statusCode, method, uri?.GetLeftPart(uriPartial), etag);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user