On Mon, Jan 18, 2021 at 2:38 PM José Oliver Segura <[email protected]>
wrote:

> Hi all,
>
> I haven't been able to find how to do this, so I would like to ask if it's
> somehow supported or not.
>
> During development, logging of SQL statements include the full statement,
> including blobs contents when they're involved. For some large blobs, this
> slows down development and makes logging almost unusable, since you need to
> do a lot of scroll to find where things where happening.
>
> So, is there any way to make Sequel suppress part of those blobs when
> logging? I'll be happy with just some start/end bytes (something like
> Blob.inspect does)
>

Sequel logs the full SQL statement submitted, there is nothing available
currently to log different SQL than what is submitted to the database.
You'll have to use a custom log formatter if you want to modify the logged
output.  Maybe something similar to:

require 'logger'
logger = Logger.new
logger.formatter = proc do |severity, datetime, progname, msg|
  msg = msg.gsub(/blob_col = '([^']+)'/){"blob_col = [#{$1.size} bytes]"}
  "#{datetime}: #{msg}\n"
end
DB.logger = logger

Thanks,
Jeremy

-- 
You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sequel-talk/CADGZSScdvZAejK-ZCabNERp%2BF-Kc4MBnSOi2%3DVe%3D2MW%2BMCTMkw%40mail.gmail.com.

Reply via email to