[GH-ISSUE #1016] [FEATURE REQUEST] Logger interface support context.Context #488

Open
opened 2026-03-02 05:21:32 +03:00 by kerem · 1 comment
Owner

Originally created by @poetlife on GitHub (Feb 10, 2025).
Original GitHub issue: https://github.com/hibiken/asynq/issues/1016

Originally assigned to: @hibiken, @kamikazechaser on GitHub.

Is your feature request related to a problem? Please describe.

Current log.Base interface doesn't support explicitly pass ctx param which is important for log observability such as OpenTelemetry.

Describe the solution you'd like

Provide another interface which accepts a ctx context.Context parameter, such as:

type LoggerWithContext interface {
	// Debug logs a message at Debug level.
	Debug(ctx context.Context, args ...interface{})

	// ...
}

Describe alternatives you've considered

No alternatives.

Additional context

In production environments, we need something like trace_id to relate many logs. So, it's important to log with context.

Originally created by @poetlife on GitHub (Feb 10, 2025). Original GitHub issue: https://github.com/hibiken/asynq/issues/1016 Originally assigned to: @hibiken, @kamikazechaser on GitHub. **Is your feature request related to a problem? Please describe.** Current `log.Base` interface doesn't support explicitly pass `ctx` param which is important for log observability such as OpenTelemetry. **Describe the solution you'd like** Provide another interface which accepts a `ctx context.Context` parameter, such as: ```go type LoggerWithContext interface { // Debug logs a message at Debug level. Debug(ctx context.Context, args ...interface{}) // ... } ``` **Describe alternatives you've considered** No alternatives. **Additional context** In production environments, we need something like `trace_id` to relate many logs. So, it's important to log with context.
Author
Owner

@jittery-droid commented on GitHub (Apr 2, 2025):

My company also needs this feature

<!-- gh-comment-id:2772805061 --> @jittery-droid commented on GitHub (Apr 2, 2025): My company also needs this feature
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/asynq#488
No description provided.