Class: SelectRailsLog::Filter::LogsRegexpFilter

Inherits:
BaseFilter show all
Defined in:
lib/select_rails_log/filter/logs_regexp_filter.rb

Constant Summary

Constants included from Constants

Constants::ACTION, Constants::CLIENT, Constants::COMPLETED, Constants::CONTROLLER, Constants::DEBUG, Constants::DEFAULT_OUTPUT, Constants::DURATION, Constants::HTTP_METHOD, Constants::HTTP_STATUS, Constants::ID, Constants::INTERVAL, Constants::LOGS, Constants::MESSAGE, Constants::PARAMETERS, Constants::PATH, Constants::PERFORMANCE, Constants::PERFORMANCE_ACTIVE_RECORD, Constants::PERFORMANCE_ALLOCATIONS, Constants::PERFORMANCE_VIEWS, Constants::PID, Constants::RAW_LOGS, Constants::REQUEST_ID, Constants::SEVERITY, Constants::STARTED, Constants::TIME

Instance Attribute Summary

Attributes inherited from Extension

#options

Instance Method Summary collapse

Methods inherited from BaseFilter

filter_type, #line_filter?, #request_filter?

Methods inherited from Extension

option_initializers

Constructor Details

#initializeLogsRegexpFilter

Returns a new instance of LogsRegexpFilter.



13
14
15
16
# File 'lib/select_rails_log/filter/logs_regexp_filter.rb', line 13

def initialize(...)
  super
  @regexp = options[:regexp]
end

Instance Method Details

#run(data) ⇒ Object



22
23
24
# File 'lib/select_rails_log/filter/logs_regexp_filter.rb', line 22

def run(data)
  data[LOGS].any? { |log| @regexp.match?(log[MESSAGE]) }
end

#runnable?Boolean

Returns:

  • (Boolean)


18
19
20
# File 'lib/select_rails_log/filter/logs_regexp_filter.rb', line 18

def runnable?
  !!@regexp
end