Missing ability to set sequel log level #332

Closed
jeremyevans opened this Issue May 1, 2011 · 1 comment

Projects

None yet

1 participant

@jeremyevans
Owner

Right now, sequel logs all queries at the "INFO" level. I want to be able to set it to the "DEBUG" level.

Google Code Info:
Issue #: 308
Author: davidomu...@gmail.com
Created On: 2010-09-08T18:02:15.000Z
Closed On: 2010-09-08T18:39:29.000Z

@jeremyevans jeremyevans was assigned May 1, 2011
@jeremyevans jeremyevans closed this May 1, 2011
@jeremyevans
Owner

The log levels are not adjustable. You can work around this by using a proxy object that accepts the info, warn, and error methods and logs to a logger at debug, warn, and error, respectively:

logger = Logger.new($stdout)
proxy = Object.new
proxy.instance_eval do
sc = (class << self; self; end)
sc.send(:define_method, :error){|_a|logger.error(_a)}
sc.send(:define_method, :warn){|_a|logger.warn(_a)}
sc.send(:define_method, :info){|_a|logger.debug(_a)}
end
DB.loggers << proxy

Google Code Info:
Author: jeremyev...@gmail.com
Created On: 2010-09-08T18:39:29.000Z

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment