Sha256: c68eb6aeaf597db8d88507b8db5421f85635f278c141ee920a44ee3217012a2e
Contents?: true
Size: 877 Bytes
Versions: 1
Compression:
Stored size: 877 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.serialize(tag.call(request)) when Symbol @kv_formatter.serialize(tag => request.send(tag)) else @kv_formatter.serialize(tag => tag) end end end end def self.enable ActiveSupport::TaggedLogging::Formatter.prepend TaggedLoggingFormatter Rails::Rack::Logger.prepend RackLogger end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
getaround_utils-0.1.6 | lib/getaround_utils/patches/key_value_log_tags.rb |