Skip to content

Commit

Permalink
Add an option on Integrity.config to turn on/off debug logging (db qu…
Browse files Browse the repository at this point in the history
…eries and rack requests)
  • Loading branch information
foca committed Jan 25, 2009
1 parent 5cd0165 commit 91a8aa6
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion config/config.sample.ru
Expand Up @@ -27,5 +27,5 @@ set :port, 8910
set :env, :production
disable :run, :reload

use Rack::CommonLogger, Integrity.logger
use Rack::CommonLogger, Integrity.logger if Integrity.config[:log_debug_info]
run Sinatra.application
4 changes: 4 additions & 0 deletions config/config.sample.yml
Expand Up @@ -16,6 +16,10 @@
# Path to the integrity log file
:log: /var/log/integrity.log

# Enable/Disable debug logging. Turning this on will log queries made to the
# database and web requests (if using the provided rackup file)
:log_debug_info: false

# Enable or disable HTTP authentication for the app. BE AWARE that if you
# disable this anyone can delete and alter projects, so do it only if your
# app is running in a controlled environment (ie, behind your company's
Expand Down
5 changes: 3 additions & 2 deletions lib/integrity.rb
Expand Up @@ -29,7 +29,7 @@
module Integrity
def self.new(config_file = nil)
self.config = config_file unless config_file.nil?
DataMapper.logger = self.logger
DataMapper.logger = self.logger if config[:log_debug_info]
DataMapper.setup(:default, config[:database_uri])
end

Expand All @@ -43,7 +43,8 @@ def self.default_configuration
:log => STDOUT,
:base_uri => "http://localhost:8910",
:use_basic_auth => false,
:build_all_commits => true }
:build_all_commits => true,
:log_debug_info => false }
end

def self.config
Expand Down

0 comments on commit 91a8aa6

Please sign in to comment.