Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion PCL.Core/IO/Net/Http/HttpSenderExtension.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public async Task<HttpResponseMessage> SendAsync(
}
catch(Exception ex)
{
LogWrapper.Error(ex, "Request", $"Try attempt failed (id = {requestId})");
LogWrapper.Debug(ex, $"Try attempt failed (id = {requestId})", "Request");
throw;
}
},
Expand Down
5 changes: 3 additions & 2 deletions PCL.Core/IO/Net/NetworkService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,10 @@ public static AsyncPolicy GetRetryPolicy(int retry = 3, Func<int,TimeSpan>? retr
attempt => retryPolicy.Invoke(attempt),
onRetry: (exception, timeSpan, retryAttempt, context) =>
{
LogWrapper.Error(
LogWrapper.Debug(
exception,
$"HTTP 请求失败,正在进行第 {retryAttempt} 次重试,等待 {timeSpan.TotalMilliseconds} 毫秒。"
$"HTTP 请求失败,正在进行第 {retryAttempt} 次重试,等待 {timeSpan.TotalMilliseconds} 毫秒。",
"Network"
);
});
}
Expand Down
2 changes: 2 additions & 0 deletions PCL.Core/Logging/LogWrapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ public static class LogWrapper
public static void Debug(string? module, string msg) => OnLog?.Invoke(LogLevel.Debug, msg, module);
public static void Debug(string msg) => Debug(null, msg);

public static void Debug(Exception ex, string message, string module) => OnLog?.Invoke(LogLevel.Debug, message, module, ex);
Comment thread
LinQingYuu marked this conversation as resolved.
Outdated

// Trace
public static void Trace(string? module, string msg) => OnLog?.Invoke(LogLevel.Trace, msg, module);
public static void Trace(string msg) => Trace(null, msg);
Expand Down
Loading