Module: QueryTracer
- Defined in:
- lib/query_tracer.rb,
lib/query_tracer/db.rb,
lib/query_tracer/logger.rb,
lib/query_tracer/tracer.rb,
lib/query_tracer/version.rb,
lib/query_tracer/db/mysql.rb,
lib/query_tracer/db/mysql2.rb,
lib/query_tracer/db/sqlite.rb,
lib/query_tracer/db/sqlite3.rb,
lib/query_tracer/tracer/revision.rb
Defined Under Namespace
Modules: Db, Tracer
Classes: Logger
Constant Summary
collapse
- VERSION =
"0.1.0"
Class Method Summary
collapse
Class Method Details
.config ⇒ Object
45
46
47
|
# File 'lib/query_tracer.rb', line 45
def self.config
@config
end
|
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
# File 'lib/query_tracer.rb', line 10
def self.configure
@config = OpenStruct.new({
:enabled => true,
:show_revision => true,
:multiline => true,
:exclude_sql => [],
:log_level => :debug
})
@config.default_codepoints = [
'(app/presenters/.*)',
'(app/views/.*)',
'(app/controllers/.*)',
'(app/models/.*)',
'(lib/.*)',
'(spec/.*)',
'(app/.*)'
]
@config.db_adapter = ActiveRecord::Base.connection.adapter_name.capitalize
begin
@config.exclude_sql << QueryTracer::Db.const_get(@config.db_adapter)::SKIP_QUERIES
@config.exclude_sql.flatten!
rescue
end
yield @config
@config.root ||= ::Rails.root
@config.include_codepoints = build_codepoints
Logger.attach_to :active_record
end
|