Class: Logasm::Preprocessors::Whitelist

Inherits:
Object
  • Object
show all
Defined in:
lib/logasm/preprocessors/whitelist.rb

Defined Under Namespace

Classes: InvalidPointerFormatException

Constant Summary collapse

DEFAULT_WHITELIST =
%w[/id /message /correlation_id /queue].freeze
MASK_SYMBOL =
'*'.freeze
MASKED_VALUE =
MASK_SYMBOL * 5
PRUNE_ACTION_NAMES =
%w[prune exclude].freeze

Instance Method Summary collapse

Constructor Details

#initialize(config = {}) ⇒ Whitelist

Returns a new instance of Whitelist.



17
18
19
20
21
22
23
24
25
# File 'lib/logasm/preprocessors/whitelist.rb', line 17

def initialize(config = {})
  trie = build_trie(config)

  @strategy = if PRUNE_ACTION_NAMES.include?(config[:action].to_s)
                Strategies::Prune.new(trie)
              else
                Strategies::Mask.new(trie)
              end
end

Instance Method Details

#process(data) ⇒ Object



27
28
29
# File 'lib/logasm/preprocessors/whitelist.rb', line 27

def process(data)
  @strategy.process(data)
end