lograge-sql-one-line 0.1.4 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/lograge/sql/extension.rb +7 -2
- data/lib/lograge/sql/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dcef8cb19ef6af4af568af145c89ab86b3a2e694
|
4
|
+
data.tar.gz: 5fd1128300c3227545ed1a5bc8d89d5bd6818795
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 653b65841d67361aa15b1e886373c461a91eae2c88fe6468d6e789e9aafef5d1046f9f2d8ef96177ed4925411de1c33a605045d57ab0728548a49489e5dada61
|
7
|
+
data.tar.gz: 9335b9a193d52b0751f51d108a1d911fcc94c46e1f12d73c09370a082c1e36febf829c6a89f75d61bd0fa44342b842bef6e97363f380df1992826a7b1ff17515
|
@@ -7,10 +7,13 @@ module Lograge
|
|
7
7
|
|
8
8
|
def extract_sql_queries
|
9
9
|
sql_queries = Thread.current[:lograge_sql_queries]
|
10
|
+
transaction_id = Thread.current[:transaction_id]
|
11
|
+
|
10
12
|
return {} unless sql_queries
|
11
13
|
|
14
|
+
Thread.current[:transaction_id] = nil
|
12
15
|
Thread.current[:lograge_sql_queries] = nil
|
13
|
-
{ sql_queries: sql_queries.
|
16
|
+
{ transaction_id: transaction_id, sql_queries: sql_queries.join }
|
14
17
|
end
|
15
18
|
end
|
16
19
|
end
|
@@ -22,7 +25,9 @@ module Lograge
|
|
22
25
|
ActiveRecord::LogSubscriber.runtime += event.duration
|
23
26
|
return if event.payload[:name] == 'SCHEMA'
|
24
27
|
Thread.current[:lograge_sql_queries] ||= []
|
25
|
-
Thread.current[:lograge_sql_queries] << ("#{event.payload[:name]} (#{event.duration.to_f.round(2)}) #{event.payload[:sql]}")
|
28
|
+
Thread.current[:lograge_sql_queries] << ("\n[#{event.transaction_id}] #{event.payload[:name]} (#{event.duration.to_f.round(2)}) #{event.payload[:sql]}")
|
29
|
+
|
30
|
+
Thread.current[:transaction_id] ||= event.transaction_id
|
26
31
|
end
|
27
32
|
end
|
28
33
|
end
|
data/lib/lograge/sql/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lograge-sql-one-line
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mattia Giuffrida
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-01-
|
11
|
+
date: 2018-01-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: lograge
|