lib/td/logger/agent/access_log.rb in td-logger-0.2.7 vs lib/td/logger/agent/access_log.rb in td-logger-0.2.8

- old
+ new

@@ -20,10 +20,16 @@ ACCESS_LOG_PRESET_PARAM_KEYS = { :controller => :controller, :action => :action, } + class MessagePackedString < String + def to_msgpack(out = '') + out << self + end + end + def self.enable_access_log(config) tag = config.access_log_table if config.rails_config.respond_to?(:filter_parameters) filter_parameters = config.rails_config.filter_parameters @@ -59,13 +65,15 @@ end # merge params req.params.each_pair {|key,val| key = key.to_sym - if !record.has_key?(key) && - !filter_parameters.include?(key) && - val.respond_to?(:to_msgpack) - record[key] = val + if !record.has_key?(key) && !filter_parameters.include?(key) + begin + record[key] = val.to_msgpack(MessagePackedString.new) + rescue + # ignore + end end } # 'method' column if !record.has_key?(:method)