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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 60c17b20ae0276e2f43d047ae740a9fae5b3c243
4
- data.tar.gz: f9e0808cf0d2d06d5341d0394a94f9fb2a3b3880
3
+ metadata.gz: dcef8cb19ef6af4af568af145c89ab86b3a2e694
4
+ data.tar.gz: 5fd1128300c3227545ed1a5bc8d89d5bd6818795
5
5
  SHA512:
6
- metadata.gz: 8f565022cb1743e616c06f957cac5d6e7d23b392c8296aa14015dce445d90aa9a36de057d076da313fd4b9f5e1db92695d4703fa512aa16bf8ca8a2ff832ef78
7
- data.tar.gz: 16bb96667c005b4225df04a5bfbc252da481cb890d898353b0def19e61afe6bcdd0d8e9517ecedbcf7e2b76eb6cb6f94f09e64e02ea61568be139e1f4faeabc5
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.inspect }
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
@@ -1,5 +1,5 @@
1
1
  module Lograge
2
2
  module Sql
3
- VERSION = '0.1.4'
3
+ VERSION = '0.1.5'
4
4
  end
5
5
  end
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
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-25 00:00:00.000000000 Z
11
+ date: 2018-01-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: lograge