Add silenced? for Action View Start subscriber

Previously, the `render_template.action_view` and
`render_layout.action_view` events would always be handled as if they
had subscribers even if the log level of its subscribers result in
nothing being logged. For regular `LogSubscriber`s,
`subscribe_log_level` could be used to optimize these cases but the
Start subscriber is not a subclass of `LogSubscriber`.

This commit implements a `#subscribed?` method for the Start subscriber
so that it can also benefit from the `subscribe_log_level` optimization.
This commit is contained in:
Hartley McGuire 2024-01-13 19:46:40 -05:00
parent 4fb230d214
commit d255ffd035
No known key found for this signature in database
GPG Key ID: E823FC1403858A82
1 changed files with 4 additions and 0 deletions

View File

@ -96,6 +96,10 @@ module ActionView
def finish(name, id, payload)
end
def silenced?(_)
logger.nil? || !logger.debug?
end
end
def self.attach_to(*)