Class: Logging::Filters::Level
- Inherits:
-
Logging::Filter
- Object
- Logging::Filter
- Logging::Filters::Level
- Defined in:
- lib/logging/filters/level.rb
Overview
The ‘Level` filter class provides a simple level-based filtering mechanism that allows events whose log level matches a preconfigured list of values.
Instance Method Summary collapse
-
#allow(event) ⇒ Object
Returns the event if it should be forwarded to the logging appender.
-
#initialize(*levels) ⇒ Level
constructor
Creates a new level filter that will only allow the given levels to propagate through to the logging destination.
Constructor Details
Instance Method Details
#allow(event) ⇒ Object
Returns the event if it should be forwarded to the logging appender. Otherwise, ‘nil` is returned. The log event is allowed if the `event.level` matches one of the levels provided to the filter when it was constructred.
27 28 29 |
# File 'lib/logging/filters/level.rb', line 27 def allow(event) @levels.include?(event.level) ? event : nil end |