Class: LogSinks::Filters::LevelFilter

Inherits:
LogSinks::Filter show all
Defined in:
lib/log_sinks/filters/level_filter.rb

Overview

Filter by event level. Pass if event level is greater or equal to filter level.

Instance Method Summary collapse

Constructor Details

#initialize(limit_level) ⇒ LevelFilter

Initializes new instance of [LogSinks::Filters::LevelFilter]

Parameters:



12
13
14
15
# File 'lib/log_sinks/filters/level_filter.rb', line 12

def initialize(limit_level)
  super()
  @limit_level = LogSinks::Level[limit_level]
end

Instance Method Details

#call(event) ⇒ Boolean

Applies filter to the event

Returns:

  • (Boolean)

    true if event pass the filter; false otherwise



20
21
22
# File 'lib/log_sinks/filters/level_filter.rb', line 20

def call(event)
  event.level >= @limit_level
end