chore: modify log level#2793
Open
LinQingYuu wants to merge 1 commit intodevfrom
Open
Conversation
评审者指南(在小型 PR 上折叠)评审者指南将暂时性 HTTP 重试失败的日志级别从 Error 降低到 Debug,并扩展日志封装器以支持带异常和模块名的 Debug 日志,从而在网络问题期间减少面向用户的错误噪音。 HTTP 重试与调试级别日志的时序图sequenceDiagram
actor UserLauncher
participant NetworkService
participant RetryPolicy
participant HttpSenderExtension
participant LogWrapper
UserLauncher->>NetworkService: GetRetryPolicy(retry, retryPolicy)
NetworkService->>RetryPolicy: ExecuteAsync(operation)
loop For_each_retry_attempt
RetryPolicy->>HttpSenderExtension: SendAsync(request, cancellationToken)
HttpSenderExtension-->>RetryPolicy: exception
RetryPolicy->>LogWrapper: Debug(ex, message, module Request)
RetryPolicy-->>NetworkService: onRetry(exception, timeSpan, retryAttempt)
NetworkService->>LogWrapper: Debug(ex, message, module Network)
end
RetryPolicy-->>UserLauncher: final_result_or_failure
HTTP 重试流程中更新后日志行为的类图classDiagram
class NetworkService {
+GetRetryPolicy(retry, retryPolicy) AsyncPolicy
}
class HttpSenderExtension {
+SendAsync(request, cancellationToken) Task~HttpResponseMessage~
}
class LogWrapper {
<<static>>
+OnLog LogHandler
+Debug(module, msg) void
+Debug(msg) void
+Debug(ex, message, module) void
+Error(ex, message) void
+Error(ex, message, module) void
}
NetworkService --> LogWrapper : uses_Debug_with_exception
HttpSenderExtension --> LogWrapper : uses_Debug_with_exception
文件级变更
提示与命令与 Sourcery 交互
自定义你的体验访问你的控制面板以:
获取帮助Original review guide in EnglishReviewer's guide (collapsed on small PRs)Reviewer's GuideLowers log severity for transient HTTP retry failures from Error to Debug and extends the logging wrapper to support exception-bearing Debug logs with module names, reducing user-facing error noise during network issues. Sequence diagram for HTTP retry and debug-level loggingsequenceDiagram
actor UserLauncher
participant NetworkService
participant RetryPolicy
participant HttpSenderExtension
participant LogWrapper
UserLauncher->>NetworkService: GetRetryPolicy(retry, retryPolicy)
NetworkService->>RetryPolicy: ExecuteAsync(operation)
loop For_each_retry_attempt
RetryPolicy->>HttpSenderExtension: SendAsync(request, cancellationToken)
HttpSenderExtension-->>RetryPolicy: exception
RetryPolicy->>LogWrapper: Debug(ex, message, module Request)
RetryPolicy-->>NetworkService: onRetry(exception, timeSpan, retryAttempt)
NetworkService->>LogWrapper: Debug(ex, message, module Network)
end
RetryPolicy-->>UserLauncher: final_result_or_failure
Class diagram for updated logging behavior in HTTP retry flowclassDiagram
class NetworkService {
+GetRetryPolicy(retry, retryPolicy) AsyncPolicy
}
class HttpSenderExtension {
+SendAsync(request, cancellationToken) Task~HttpResponseMessage~
}
class LogWrapper {
<<static>>
+OnLog LogHandler
+Debug(module, msg) void
+Debug(msg) void
+Debug(ex, message, module) void
+Error(ex, message) void
+Error(ex, message, module) void
}
NetworkService --> LogWrapper : uses_Debug_with_exception
HttpSenderExtension --> LogWrapper : uses_Debug_with_exception
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey - 我在这里给出了一些总体反馈:
- 新增的
Debug(Exception ex, string message, string module)重载与现有的Debug(string? module, string msg)重载在参数顺序模式上不一致(一个是module在最后,一个是module在最前),可能会引起混淆;建议统一参数顺序,或者再添加一个保持module为第一个参数的重载。 - 在
NetworkService.GetRetryPolicy中,你现在将模块名硬编码为"Network";如果网络栈的其他部分使用了不同的模块命名约定,建议将其提取为一个共享常量,或者确保所有日志调用在命名上保持一致。
供 AI Agent 使用的提示
Please address the comments from this code review:
## Overall Comments
- The newly added `Debug(Exception ex, string message, string module)` overload has a different parameter ordering pattern than the existing `Debug(string? module, string msg)` overloads (module first vs last), which may cause confusion; consider aligning the order or adding an overload that keeps `module` as the first argument.
- In `NetworkService.GetRetryPolicy`, you now hardcode the module name as `"Network"`; if other parts of the networking stack use a different module naming convention, consider extracting this into a shared constant or ensuring consistency across all logging calls.帮我变得更有用!请在每条评论上点 👍 或 👎,我会根据你的反馈持续改进代码审查。
Original comment in English
Hey - I've left some high level feedback:
- The newly added
Debug(Exception ex, string message, string module)overload has a different parameter ordering pattern than the existingDebug(string? module, string msg)overloads (module first vs last), which may cause confusion; consider aligning the order or adding an overload that keepsmoduleas the first argument. - In
NetworkService.GetRetryPolicy, you now hardcode the module name as"Network"; if other parts of the networking stack use a different module naming convention, consider extracting this into a shared constant or ensuring consistency across all logging calls.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- The newly added `Debug(Exception ex, string message, string module)` overload has a different parameter ordering pattern than the existing `Debug(string? module, string msg)` overloads (module first vs last), which may cause confusion; consider aligning the order or adding an overload that keeps `module` as the first argument.
- In `NetworkService.GetRetryPolicy`, you now hardcode the module name as `"Network"`; if other parts of the networking stack use a different module naming convention, consider extracting this into a shared constant or ensuring consistency across all logging calls.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
SALTWOOD
reviewed
May 4, 2026
| 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); |
ruattd
requested changes
May 4, 2026
Contributor
ruattd
left a comment
There was a problem hiding this comment.
直接提取出信息写入 message 即可
Debug 等级不支持回报 ex 的原因就是它没必要回报
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
将 HTTP 请求的日志等级下调为 Debug,以避免在网络环境不佳的情况下需要连续关掉一堆弹窗才能用启动器
(先生,这实在是太糟糕了,我的启动器全是无关紧要的错误弹窗)Summary by Sourcery
降低 HTTP 请求重试失败日志的严重级别,在保留诊断信息的同时减少用户可见的错误噪声。
改进内容:
Original summary in English
Summary by Sourcery
Lower the log severity of HTTP request retry failures to reduce user-facing error noise while preserving diagnostic information.
Enhancements: