Skip to content

feat: enhance logging with request ID support#87

Merged
soulteary merged 1 commit intomainfrom
prom-metrics
Jan 6, 2026
Merged

feat: enhance logging with request ID support#87
soulteary merged 1 commit intomainfrom
prom-metrics

Conversation

@soulteary
Copy link
Copy Markdown
Owner

  • Added functions to log messages with request IDs extracted from context, improving traceability in logs.
  • Updated existing logging methods to include request IDs for better error tracking and debugging.
  • Enhanced middleware to propagate request IDs in response headers for easier tracking across services.

- Added functions to log messages with request IDs extracted from context, improving traceability in logs.
- Updated existing logging methods to include request IDs for better error tracking and debugging.
- Enhanced middleware to propagate request IDs in response headers for easier tracking across services.
@soulteary soulteary merged commit 0fb4abd into main Jan 6, 2026
Comment thread internal/logger/logger.go
func WithRequestID(requestID string) *slog.Logger {
if DefaultLogger == nil {
// 如果未初始化,使用默认配置初始化
Init(true, false, "", false)

Check warning

Code scanning / gosec

Errors unhandled Warning

Errors unhandled
Comment thread internal/logger/logger.go
func WithContext(ctx context.Context) *slog.Logger {
if DefaultLogger == nil {
// 如果未初始化,使用默认配置初始化
Init(true, false, "", false)

Check warning

Code scanning / gosec

Errors unhandled Warning

Errors unhandled
@soulteary soulteary deleted the prom-metrics branch January 6, 2026 18:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants