Skip to content

Instantly share code, notes, and snippets.

@ruckus
Created February 22, 2010 06:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ruckus/310861 to your computer and use it in GitHub Desktop.
Save ruckus/310861 to your computer and use it in GitHub Desktop.
# MySQL BLOB logging filter.
#
class ActiveRecord::ConnectionAdapters::AbstractAdapter
# Replace BLOB portion of message with "BLOB(n bytes)".
#
# ==== Paramters
def format_log_entry_with_blob_filter(message, dump = nil)
dump.gsub!(/x'[^']+'/) { |blob| "BLOB(#{(blob.length-3)/2} bytes)" } if dump
format_log_entry_without_blob_filter(message, dump)
end
alias_method_chain :format_log_entry, :blob_filter
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment