Merged
Conversation
Updated the error handling and logging mechanisms to utilize a structured logging format. Replaced traditional logging with a logger package for improved clarity and consistency. Enhanced the logError function to build structured log messages, including additional context such as request IDs and hook IDs, improving the overall error tracking and debugging process.
Enhanced the error handling process by implementing structured logging, which includes additional context such as request IDs and hook IDs. This update improves clarity and consistency in error tracking. Additionally, refactored the makeSureCallable function to support context parameters for better cancellation handling during command validation.
| writer = io.Discard | ||
| } else if logPath != "" { | ||
| // 打开日志文件 | ||
| logFile, err := os.OpenFile(logPath, os.O_CREATE|os.O_WRONLY|os.O_APPEND, 0o600) |
Check failure
Code scanning / gosec
Potential file inclusion via variable Error
| args := []any{ | ||
| "status", status, | ||
| "bytes", bytes, | ||
| "size", humanize.IBytes(uint64(bytes)), |
Check failure
Code scanning / gosec
integer overflow conversion int -> uint64 Error
| func With(args ...any) *slog.Logger { | ||
| if DefaultLogger == nil { | ||
| // 如果未初始化,使用默认配置初始化 | ||
| Init(true, false, "", false) |
Check warning
Code scanning / gosec
Errors unhandled Warning
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.
No description provided.