lograge-sql-one-line 0.1.6 → 0.1.7

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: ee098cd725561bbc5ab9fc259979d34c2d3bbcee
4
- data.tar.gz: d4518423e8ea0fc3d12a7b866ebd948c52e39a49
3
+ metadata.gz: 892a353c6624097db9bfdb653ef66dbf7b9e5119
4
+ data.tar.gz: b284728d7d28b8ecf17df5c80d46a3990fd96d1c
5
5
  SHA512:
6
- metadata.gz: 268b02326ebe8922fa01d268a0c881db841b9931c124b0bb7dde99e37e8b8a7706281d26bc648dc0f90317c60b9f9be8380ad9f53730a460567a420bacdb7a20
7
- data.tar.gz: 60e7a136c28d4123d21563b6fff4c4e39ba2ef13ccdce6650c563499d074aa05decb631dc556080eb9515aa13b2aa72027e43a5a361ab91d04b6b158f21f4bb2
6
+ metadata.gz: 6de240a17ef479f80132c83208c2cce7d4e19c2844c1f9374260f413bf0a1cbf80789ba7838f69f06eca25b2c900b390dbc93511377c362ee799d36dfb1cc270
7
+ data.tar.gz: 2c86a628cd8aa40d67e95bfe32410a6f531e2bf7a22686a2a5b7a89a2e1b9cc32f78e359b5be6066cf2d89516818d5bc86e9390bf207b8ef8363645264bf5a91
@@ -2,20 +2,27 @@ module Lograge
2
2
  module Sql
3
3
  module Extension
4
4
  def extract_request(event, payload)
5
- super.merge!(extract_sql_queries(payload[:uuid]))
5
+ super.merge!(extract_sql_queries(payload[:uuid], payload[:log_sql]))
6
6
  end
7
7
 
8
- def extract_sql_queries(uuid)
8
+ def extract_sql_queries(uuid, log_sql)
9
9
  sql_queries = Thread.current[:lograge_sql_queries]
10
10
  return {} unless sql_queries
11
+ return {} unless log_sql
11
12
 
12
13
  Thread.current[:lograge_sql_queries] = nil
13
14
 
14
- sql_queries_with_uuid = sql_queries.map do |query|
15
- "\n[#{uuid}] #{query}"
15
+ formatted_queries = if uuid
16
+ queries_with_uuid = sql_queries.map do |query|
17
+ "\n[#{uuid}] #{query}"
18
+ end
19
+
20
+ queries_with_uuid.join
21
+ else
22
+ sql_queries.join("\n")
16
23
  end
17
24
 
18
- { sql_queries: sql_queries_with_uuid.join }
25
+ { sql_queries: formatted_queries }
19
26
  end
20
27
  end
21
28
  end
@@ -1,5 +1,5 @@
1
1
  module Lograge
2
2
  module Sql
3
- VERSION = '0.1.6'
3
+ VERSION = '0.1.7'
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.6
4
+ version: 0.1.7
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-30 00:00:00.000000000 Z
11
+ date: 2018-02-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: lograge
@@ -125,7 +125,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
125
125
  version: '0'
126
126
  requirements: []
127
127
  rubyforge_project:
128
- rubygems_version: 2.6.10
128
+ rubygems_version: 2.6.14
129
129
  signing_key:
130
130
  specification_version: 4
131
131
  summary: An extension for Lograge to log SQL queries