Sha256: 02f480878629f5499cdf22c00bea1c54e35187d3910b8b3da500baa70c5e0360

Contents?: true

Size: 576 Bytes

Versions: 9

Compression:

Stored size: 576 Bytes

Contents

module LogStasher
  module CustomFields
    module LogSubscriber
      def extract_custom_fields(data)
        (!CustomFields.custom_fields.empty? && data.extract!(*CustomFields.custom_fields)) || {}
      end
    end
    
    def self.clear
      Thread.current[:logstasher_custom_fields] = []
    end

    def self.add(*fields)
      custom_fields.concat(fields).uniq!
    end

    def self.custom_fields
      Thread.current[:logstasher_custom_fields] ||= []
    end

    def self.custom_fields=(val)
      Thread.current[:logstasher_custom_fields] = val
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
logstasher-1.4.0 lib/logstasher/custom_fields.rb
logstasher-1.3.0 lib/logstasher/custom_fields.rb
logstasher-1.2.2 lib/logstasher/custom_fields.rb
logstasher-1.2.1 lib/logstasher/custom_fields.rb
logstasher-1.2.0 lib/logstasher/custom_fields.rb
logstasher-1.1.1 lib/logstasher/custom_fields.rb
logstasher-1.1.0 lib/logstasher/custom_fields.rb
logstasher-1.0.1 lib/logstasher/custom_fields.rb
logstasher-1.0.0 lib/logstasher/custom_fields.rb