[GH-ISSUE #143] [FEATURE REQUEST] Allow setting log levels #45

Closed
opened 2026-03-02 05:18:12 +03:00 by kerem · 1 comment
Owner

Originally created by @hibiken on GitHub (Apr 28, 2020).
Original GitHub issue: https://github.com/hibiken/asynq/issues/143

Originally assigned to: @hibiken on GitHub.

Is your feature request related to a problem? Please describe.
User of the package should be able to set the minimum log level.
This would be also useful in testing, since logs in CI are currently a bit noisy when running tests with -v flag.

Describe the solution you'd like
Add LogLevel field in Config and define Level type and expose predefined enums for each level

srv := asynq.NewServer(r, asynq.Config{
    LogLevel: asynq.InfoLevel,
})

Describe alternatives you've considered
Expose DefaultLogger and allow user to set level through that object.

asynq.DefaultLogger.SetLevel(asynq.InfoLevel) 

Cons of this approach is that we have to define a new type for DefaultLogger which has SetLevel(l Level) as a method.

Additional context
None for now

Originally created by @hibiken on GitHub (Apr 28, 2020). Original GitHub issue: https://github.com/hibiken/asynq/issues/143 Originally assigned to: @hibiken on GitHub. **Is your feature request related to a problem? Please describe.** User of the package should be able to set the minimum log level. This would be also useful in testing, since logs in CI are currently a bit noisy when running tests with -v flag. **Describe the solution you'd like** Add `LogLevel` field in `Config` and define `Level` type and expose predefined enums for each level ``` srv := asynq.NewServer(r, asynq.Config{ LogLevel: asynq.InfoLevel, }) ``` **Describe alternatives you've considered** Expose `DefaultLogger` and allow user to set level through that object. ```go asynq.DefaultLogger.SetLevel(asynq.InfoLevel) ``` Cons of this approach is that we have to define a new type for `DefaultLogger` which has `SetLevel(l Level)` as a method. **Additional context** None for now
kerem 2026-03-02 05:18:12 +03:00
Author
Owner

@hibiken commented on GitHub (May 16, 2020):

Closed via v.0.9.0

<!-- gh-comment-id:629659966 --> @hibiken commented on GitHub (May 16, 2020): Closed via v.0.9.0
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#45
No description provided.