time_bandits 0.10.8 → 0.10.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/lib/time_bandits/monkey_patches/active_record.rb +21 -2
- data/lib/time_bandits/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: a9c20c5271abcd261d1eb1603550bd9e8a2e9f557454bc0369ad41e4a46d77f3
|
4
|
+
data.tar.gz: 6b327e85bff4a1c9b2c30f6dbc206503d684a1e3fba471f4c9f2774e25b55592
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d9c26ef3f4e1ba927e45a5bd3febfa515ac2b132e2ea4b1aae2277cfd22097133aaefc23fb9617fc1e5a98becd45f467079fd7ade31e68269e9872a987741b4e
|
7
|
+
data.tar.gz: d09270ae8cc230a0b4dcad0604d75a437da6780539cf1777aa53bdf86b8ee8aaaa9f24fa288f854715b2bd3d3e1b5f3fea05a2c1a99184d188a2b6ea31112a21
|
@@ -70,7 +70,7 @@ module ActiveRecord
|
|
70
70
|
def sql(event)
|
71
71
|
self.class.runtime += event.duration
|
72
72
|
self.class.call_count += 1
|
73
|
-
self.class.query_cache_hits += 1 if event.payload[:name] == "CACHE"
|
73
|
+
self.class.query_cache_hits += 1 if payload[:cached] || event.payload[:name] == "CACHE"
|
74
74
|
|
75
75
|
return unless logger.debug?
|
76
76
|
|
@@ -84,7 +84,26 @@ module ActiveRecord
|
|
84
84
|
public
|
85
85
|
|
86
86
|
private
|
87
|
-
if Rails::VERSION::STRING >= "5.
|
87
|
+
if Rails::VERSION::STRING >= "5.1.5"
|
88
|
+
def log_sql_statement(payload, event)
|
89
|
+
name = "#{payload[:name]} (#{event.duration.round(1)}ms)"
|
90
|
+
name = "CACHE #{name}" if payload[:cached]
|
91
|
+
sql = payload[:sql]
|
92
|
+
binds = nil
|
93
|
+
|
94
|
+
unless (payload[:binds] || []).empty?
|
95
|
+
casted_params = type_casted_binds(payload[:type_casted_binds])
|
96
|
+
binds = " " + payload[:binds].zip(casted_params).map { |attr, value|
|
97
|
+
render_bind(attr, value)
|
98
|
+
}.inspect
|
99
|
+
end
|
100
|
+
|
101
|
+
name = colorize_payload_name(name, payload[:name])
|
102
|
+
sql = color(sql, sql_color(sql), true)
|
103
|
+
|
104
|
+
debug " #{name} #{sql}#{binds}"
|
105
|
+
end
|
106
|
+
elsif Rails::VERSION::STRING >= "5.0.3"
|
88
107
|
def log_sql_statement(payload, event)
|
89
108
|
name = '%s (%.1fms)' % [payload[:name], event.duration]
|
90
109
|
sql = payload[:sql].squeeze(' ')
|
data/lib/time_bandits/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: time_bandits
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.10.
|
4
|
+
version: 0.10.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stefan Kaes
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-02-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thread_variables
|
@@ -304,7 +304,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
304
304
|
version: '0'
|
305
305
|
requirements: []
|
306
306
|
rubyforge_project:
|
307
|
-
rubygems_version: 2.
|
307
|
+
rubygems_version: 2.7.3
|
308
308
|
signing_key:
|
309
309
|
specification_version: 4
|
310
310
|
summary: Custom performance logging for Rails
|