-
Notifications
You must be signed in to change notification settings - Fork 137
[feat] make logger in Rails include AS::LoggerSilence #303
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
I'm not sure I have the Rails logging expertise to seriously evaluate this but I'll have a go! |
apologies, was testing out a (AI) work-flow locally and ended up with a premature merge... 🍼 |
giving up on co-pilot here, asked it for a revert and re-open a got me with: #307 😒 |
ActiveSupport::TaggedLogging.new(logger) # returns a logger.clone | ||
logger = ActiveSupport::TaggedLogging.new(logger) # returns a logger.clone | ||
logger.singleton_class.instance_eval do | ||
include ActiveSupport::LoggerSilence if defined?(ActiveSupport::LoggerSilence) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should have just send(:include)
here instead of eval-ing...
end | ||
|
||
# Silences the logger for the duration of the block. | ||
def silence(severity = Logger::ERROR) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe we should remove logger.silence
from JRuby::Rack::Logger
impl, which includes a dummy silence(level) { ... }
implementation that does nothing (simply yields).
relevant changes in src/main/ruby/jruby/rack/rails/railtie.rb
the rest is getting stubs from Rails to be able to test this wout actual Rails
an alternative proposal to: #270