Permalink
Browse files

README updates

  • Loading branch information...
1 parent 1d0e887 commit 7496abcdbb79880151f4f4a6c91a1a7626d36d07 @smtlaissezfaire committed Dec 31, 2009
Showing with 15 additions and 11 deletions.
  1. +15 −11 README.rdoc
View
@@ -19,27 +19,31 @@ Migrate:
All select queries will be logged to the query_logs table. You now have the ability to
store historical data of all of your database access.
-You can turn off all query logging by putting the following in environment.rb:
+If you'd like finer grained control over logging, provide a block to EnhancedQueryAnalyzer.log_if:
- EnhancedQueryAnalyzer.logging = false
+ EnhancedQueryAnalyzer.log_if { |query, time| <true | false> }
-You can also add the ability to dynamically run and log the explain of each query:
+For instance, if you'd only like to log queries over a second:
- EnhancedQueryAnalyzer.explain_logging = true
+ EnhancedQueryAnalyzer.log_if { |_, time| time > 1 }
-=== Finer grained control:
+Or only log queries matching some regex:
-If you'd like finer grained control over logging, provide a block to EnhancedQueryAnalyzer.log_if:
+ EnhancedQueryAnalyzer.log_if { |query, time| query =~ /select.../ }
- EnhancedQueryAnalyzer.log_if { |query, time| <true | false> }
+To turn off all logging:
-For instance, if you'd only like to log queries over a second:
+ EnhancedQueryAnalyzer.log_if { |_, _| false }
- EnhancedQueryAnalyzer.log_if { |_, time| time > 1 }
+Or in everything but the test environment (this is recommended):
-or only log select queries:
+ EnhancedQueryAnalyzer.log_if do |query, time|
+ RAILS_ENV != "test"
+ end
+
+You can also add the ability to dynamically run and log the explain of each query:
- EnhancedQueryAnalyzer.log_if { |query, time| query =~ /select/i }
+ EnhancedQueryAnalyzer.explain_logging = true
== Running Unit Tests

0 comments on commit 7496abc

Please sign in to comment.