Class: Dry::Logger::Filter Private

Inherits:
Object
  • Object
show all
Defined in:
lib/dry/logger/filter.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Filtering logic Originaly copied from hanami/utils (see Hanami::Logger)

Since:

  • 0.1.0

Instance Method Summary collapse

Constructor Details

#initialize(filters = []) ⇒ Filter

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of Filter.

Since:

  • 0.1.0



13
14
15
# File 'lib/dry/logger/filter.rb', line 13

def initialize(filters = [])
  @filters = filters
end

Instance Method Details

#call(hash) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Since:

  • 0.1.0



19
20
21
22
23
24
25
26
# File 'lib/dry/logger/filter.rb', line 19

def call(hash)
  _filtered_keys(hash).each do |key|
    *keys, last = _actual_keys(hash, key.split("."))
    keys.inject(hash, :fetch)[last] = "[FILTERED]"
  end

  hash
end