google-drive-ruby icon indicating copy to clipboard operation
google-drive-ruby copied to clipboard

Decrease output into ruby logs

Open ldanielw1 opened this issue 1 year ago • 1 comments

Is there a way to not output the API call outputs into the ruby logs unless some verbose flag is on? I love this gem, but it's making it hard to read my current ruby logs when I keep calling Drive APIs.

ldanielw1 avatar Sep 17 '24 13:09 ldanielw1

You can use this workaround in config/environments/development.rb:

Google::Apis.logger.formatter = proc do |severity, datetime, progname, msg|
  msg.is_a?(String) && msg.match?(/(HTTP::Message::Body:)|(Success - )/) ? nil : Rails.logger.formatter.call(severity, datetime, progname, msg)
end
Google::Apis.logger.level = Logger::DEBUG

mario-amazing avatar Dec 10 '24 16:12 mario-amazing