Sha256: 8e48e475551ed8a10d97c49870045083a11f9aa128aeeff76fc67e5a6930f2b8
Contents?: true
Size: 862 Bytes
Versions: 2
Compression:
Stored size: 862 Bytes
Contents
require 'rails/railtie' require 'getaround_utils/log_formatters/deep_key_value' module GetaroundUtils; end module GetaroundUtils::Patches; end class GetaroundUtils::Patches::KeyValueLogTags module TaggedLoggingFormatter def tags_text "#{current_tags.join(' ')} " if current_tags.any? end end module RackLogger def compute_tags(request) @kv_formatter ||= GetaroundUtils::LogFormatters::DeepKeyValue.new @taggers.collect do |tag| case tag when Proc @kv_formatter.call(tag.call(request)) when Symbol @kv_formatter.call(tag => request.send(tag)) else @kv_formatter.call(tag => tag) end end end end def self.enable ActiveSupport::TaggedLogging::Formatter.prepend TaggedLoggingFormatter Rails::Rack::Logger.prepend RackLogger end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
getaround_utils-0.1.5 | lib/getaround_utils/patches/key_value_log_tags.rb |
getaround_utils-0.1.4 | lib/getaround_utils/patches/key_value_log_tags.rb |