Class: Kubetailrb::Filter::LogFilter
- Inherits:
-
Object
- Object
- Kubetailrb::Filter::LogFilter
- Includes:
- Validated
- Defined in:
- lib/kubetailrb/filter/log_filter.rb
Overview
Filter the logs that we do not want to see. Currently only supporting excluding access logs and datadog logs.
Class Method Summary collapse
Instance Method Summary collapse
- #exclude_access_logs? ⇒ Boolean
- #exclude_dd_logs? ⇒ Boolean
-
#initialize(exclude_access_logs, exclude_dd_logs) ⇒ LogFilter
constructor
A new instance of LogFilter.
-
#test(log) ⇒ Object
Returns true if the log should be print, false otherwise.
Methods included from Validated
#raise_if_blank, #raise_if_nil, #validate_boolean, #validate_last_nb_lines
Constructor Details
#initialize(exclude_access_logs, exclude_dd_logs) ⇒ LogFilter
Returns a new instance of LogFilter.
16 17 18 19 20 21 |
# File 'lib/kubetailrb/filter/log_filter.rb', line 16 def initialize(exclude_access_logs, exclude_dd_logs) @exclude_access_logs = exclude_access_logs @exclude_dd_logs = exclude_dd_logs validate end |
Class Method Details
.create(exclude) ⇒ Object
12 13 14 |
# File 'lib/kubetailrb/filter/log_filter.rb', line 12 def self.create(exclude) new(exclude.include?('access-logs'), exclude.include?('dd-logs')) end |
Instance Method Details
#exclude_access_logs? ⇒ Boolean
31 32 33 |
# File 'lib/kubetailrb/filter/log_filter.rb', line 31 def exclude_access_logs? @exclude_access_logs end |
#exclude_dd_logs? ⇒ Boolean
35 36 37 |
# File 'lib/kubetailrb/filter/log_filter.rb', line 35 def exclude_dd_logs? @exclude_dd_logs end |
#test(log) ⇒ Object
Returns true if the log should be print, false otherwise.
24 25 26 27 28 29 |
# File 'lib/kubetailrb/filter/log_filter.rb', line 24 def test(log) return false if @exclude_access_logs && access_log?(log) return false if @exclude_dd_logs && dd_log?(log) true end |