lograge-sql-one-line 0.1.5 → 0.1.6

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: dcef8cb19ef6af4af568af145c89ab86b3a2e694
4
- data.tar.gz: 5fd1128300c3227545ed1a5bc8d89d5bd6818795
3
+ metadata.gz: ee098cd725561bbc5ab9fc259979d34c2d3bbcee
4
+ data.tar.gz: d4518423e8ea0fc3d12a7b866ebd948c52e39a49
5
5
  SHA512:
6
- metadata.gz: 653b65841d67361aa15b1e886373c461a91eae2c88fe6468d6e789e9aafef5d1046f9f2d8ef96177ed4925411de1c33a605045d57ab0728548a49489e5dada61
7
- data.tar.gz: 9335b9a193d52b0751f51d108a1d911fcc94c46e1f12d73c09370a082c1e36febf829c6a89f75d61bd0fa44342b842bef6e97363f380df1992826a7b1ff17515
6
+ metadata.gz: 268b02326ebe8922fa01d268a0c881db841b9931c124b0bb7dde99e37e8b8a7706281d26bc648dc0f90317c60b9f9be8380ad9f53730a460567a420bacdb7a20
7
+ data.tar.gz: 60e7a136c28d4123d21563b6fff4c4e39ba2ef13ccdce6650c563499d074aa05decb631dc556080eb9515aa13b2aa72027e43a5a361ab91d04b6b158f21f4bb2
@@ -2,18 +2,20 @@ module Lograge
2
2
  module Sql
3
3
  module Extension
4
4
  def extract_request(event, payload)
5
- super.merge!(extract_sql_queries)
5
+ super.merge!(extract_sql_queries(payload[:uuid]))
6
6
  end
7
7
 
8
- def extract_sql_queries
8
+ def extract_sql_queries(uuid)
9
9
  sql_queries = Thread.current[:lograge_sql_queries]
10
- transaction_id = Thread.current[:transaction_id]
11
-
12
10
  return {} unless sql_queries
13
11
 
14
- Thread.current[:transaction_id] = nil
15
12
  Thread.current[:lograge_sql_queries] = nil
16
- { transaction_id: transaction_id, sql_queries: sql_queries.join }
13
+
14
+ sql_queries_with_uuid = sql_queries.map do |query|
15
+ "\n[#{uuid}] #{query}"
16
+ end
17
+
18
+ { sql_queries: sql_queries_with_uuid.join }
17
19
  end
18
20
  end
19
21
  end
@@ -25,9 +27,7 @@ module Lograge
25
27
  ActiveRecord::LogSubscriber.runtime += event.duration
26
28
  return if event.payload[:name] == 'SCHEMA'
27
29
  Thread.current[:lograge_sql_queries] ||= []
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
30
+ Thread.current[:lograge_sql_queries] << ("#{event.payload[:name]} (#{event.duration.to_f.round(2)}) #{event.payload[:sql]}")
31
31
  end
32
32
  end
33
33
  end
@@ -1,5 +1,5 @@
1
1
  module Lograge
2
2
  module Sql
3
- VERSION = '0.1.5'
3
+ VERSION = '0.1.6'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lograge-sql-one-line
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mattia Giuffrida