Project

General

Profile

Actions

Feature #16144

closed

Honor Logger#level overrides in Logger#add

Added by georgeclaghorn (George Claghorn) about 5 years ago. Updated about 5 years ago.

Status:
Closed
Assignee:
-
Target version:
-
[ruby-core:94781]

Description

We attempt to override Logger#level in Rails’s Logger subclass to allow setting a different level per thread (and thus per request). But Logger#add checks the new message’s severity against the @level instance variable, so overriding #level doesn’t have the intended effect. (Because we prepend a check against #level to #add, you can only set the thread-local level greater than or equal to @level, not less. We’d like to allow setting any thread-local level.)

This patch modifies Logger#add to check #level so that third-party loggers can customize how the current level is determined without needing to reimplement #add or juggle multiple underlying Logger instances.

This is my first Ruby patch. I wasn’t sure whether to submit it here or ruby/logger on GitHub. I’m sorry if this isn’t the right place.


Files

Updated by shevegen (Robert A. Heiler) about 5 years ago

This is my first Ruby patch. I wasn’t sure whether to submit it here or ruby/logger on GitHub.
I’m sorry if this isn’t the right place.

Although lots of people work via/through GitHub, including some core team members, this here
is still the official bugtracker, so don't worry, it's the right place. I guess someone from
the core team has to review the patch before it can be added.

Updated by jeremyevans0 (Jeremy Evans) about 5 years ago

Can you please submit this as a pull request to ruby/logger: https://github.com/ruby/logger/pulls

For feature requests and bug reports for Ruby itself, it's best to open an issue on this bug tracker, but for feature requests and bug fixes in one of the gems that ship with Ruby (including default gems that ship with Ruby and are in stdlib), it's probably best to submit a pull request/issue directly to the upstream project on GitHub.

Updated by georgeclaghorn (George Claghorn) about 5 years ago

jeremyevans0 (Jeremy Evans) wrote:

Can you please submit this as a pull request to ruby/logger: https://github.com/ruby/logger/pulls

For feature requests and bug reports for Ruby itself, it's best to open an issue on this bug tracker, but for feature requests and bug fixes in one of the gems that ship with Ruby (including default gems that ship with Ruby and are in stdlib), it's probably best to submit a pull request/issue directly to the upstream project on GitHub.

Done.

Updated by georgeclaghorn (George Claghorn) about 5 years ago

My GitHub PR was merged, so I think this can be closed.

Actions #5

Updated by jeremyevans0 (Jeremy Evans) about 5 years ago

  • Status changed from Open to Closed
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0