Sha256: c08529324d27510e30dd5bbc972e85d87478957bd33e01d54d258a83706a1423
Contents?: true
Size: 877 Bytes
Versions: 2
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 @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.3 | lib/getaround_utils/patches/key_value_log_tags.rb |
getaround_utils-0.1.2 | lib/getaround_utils/patches/key_value_log_tags.rb |