Override logger for large binary data

I’ve searched high and low and played around and couldn’t figure out
how to override what the logger prints for a specific model (one that
has many columns of multi-100K blobs).

I ‘tail -f log/development.log’ in a shell within emacs and it really
doesn’t like the huge lines dumped out during saves/updates.

So, I finally figured out that if I put the following in my
config/environment.rb I can trim the binary data dumps:

class Logger
private
alias old_format_message format_message

def format_message(severity, timestamp, progname, msg)
# uses a non-greedy match
msg.to_str.gsub!(/= x’(.*?)’(,|\s)/,’= x’BINARY_DATA’\2’)
“#{msg}\n”
end
end

But, I know that this is a kluge so any advice on how to control the
dump on column level within the model or even on the model level will
be much appreciated.

Thanks much.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs