diff options
author | Matthew M. Boedicker <matthewm@boedicker.org> | 2012-12-13 23:29:49 -0800 |
---|---|---|
committer | Matthew M. Boedicker <matthewm@boedicker.org> | 2012-12-14 12:19:17 -0800 |
commit | 8f59ffce671c9b467b0f97b420305a9faa5214d8 (patch) | |
tree | cf9b89c3cee6150912a2a1720eb792802ae198dc /activerecord/lib | |
parent | fa3457dc3b30e3dde5bc4b041f59c037c76e1f8b (diff) | |
download | rails-8f59ffce671c9b467b0f97b420305a9faa5214d8.tar.gz rails-8f59ffce671c9b467b0f97b420305a9faa5214d8.tar.bz2 rails-8f59ffce671c9b467b0f97b420305a9faa5214d8.zip |
Do not log the binding values for binary columns.
They tend to be large and not very useful in the log.
Diffstat (limited to 'activerecord/lib')
-rw-r--r-- | activerecord/lib/active_record/log_subscriber.rb | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/log_subscriber.rb b/activerecord/lib/active_record/log_subscriber.rb index ca79950049..11ec2eaf79 100644 --- a/activerecord/lib/active_record/log_subscriber.rb +++ b/activerecord/lib/active_record/log_subscriber.rb @@ -20,6 +20,16 @@ module ActiveRecord @odd_or_even = false end + def render_bind(column, value) + if column.type == :binary + rendered_value = "<#{value.bytesize} bytes of binary data>" + else + rendered_value = value + end + + [column.name, rendered_value] + end + def sql(event) self.class.runtime += event.duration return unless logger.debug? @@ -34,7 +44,7 @@ module ActiveRecord unless (payload[:binds] || []).empty? binds = " " + payload[:binds].map { |col,v| - [col.name, v] + render_bind(col, v) }.inspect end |