lograge-sql 1.1.0 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.rubocop.yml +1 -1
- data/README.md +6 -0
- data/lib/lograge/sql.rb +7 -0
- data/lib/lograge/sql/extension.rb +0 -4
- data/lib/lograge/sql/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3726273a2b54f66be4bbdab30b8b2166d9d45f00d2e27b7e0f217aab51befe14
|
4
|
+
data.tar.gz: b35279e56a149def5f8ac6db9d564bc27e264971b15bfe064d63e87a8398ce26
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7d171a9e1a9f2152cc4e3d22434334849f3df4aca8131fb625967ecd79d390a3cb555ce14f6839023221dee85415be8c5068c46492b602d22cd28f69a4fe1309
|
7
|
+
data.tar.gz: dd425accb219b4342a58a1a7275ba032c11e3d8caa04b6342ca7db8a8ddf8ec3552097cca95d4e4d3a6b0c8c9240b519dfb3ab6285a3b2ebfeaf14147c816fed
|
data/.rubocop.yml
CHANGED
data/README.md
CHANGED
@@ -23,6 +23,12 @@ In order to enable SQL logging in your application, you'll simply need to add th
|
|
23
23
|
require 'lograge/sql/extension'
|
24
24
|
```
|
25
25
|
|
26
|
+
By default, Lograge::Sql disables default logging on ActiveRecord. To preserve default logging, add this to your lograge initializer:
|
27
|
+
|
28
|
+
```ruby
|
29
|
+
config.lograge_sql.keep_default_active_record_log = true
|
30
|
+
```
|
31
|
+
|
26
32
|
## Customization
|
27
33
|
|
28
34
|
By default, the format is a string concatenation of the query name, the query duration and the query itself joined by `\n` newline:
|
data/lib/lograge/sql.rb
CHANGED
@@ -15,6 +15,13 @@ module Lograge
|
|
15
15
|
def setup(config)
|
16
16
|
Lograge::Sql.formatter = config.formatter || default_formatter
|
17
17
|
Lograge::Sql.extract_event = config.extract_event || default_extract_event
|
18
|
+
|
19
|
+
return if config.keep_default_active_record_log
|
20
|
+
|
21
|
+
# Disable existing ActiveRecord logging
|
22
|
+
ActiveSupport::LogSubscriber.log_subscribers.each do |subscriber|
|
23
|
+
Lograge.unsubscribe(:active_record, subscriber) if subscriber.is_a?(ActiveRecord::LogSubscriber)
|
24
|
+
end
|
18
25
|
end
|
19
26
|
|
20
27
|
def store
|
@@ -45,8 +45,4 @@ else
|
|
45
45
|
Lograge::LogSubscribers::ActionController.prepend Lograge::Sql::Extension
|
46
46
|
end
|
47
47
|
|
48
|
-
ActiveSupport::LogSubscriber.log_subscribers.each do |subscriber|
|
49
|
-
Lograge.unsubscribe(:active_record, subscriber) if subscriber.is_a?(ActiveRecord::LogSubscriber)
|
50
|
-
end
|
51
|
-
|
52
48
|
Lograge::ActiveRecordLogSubscriber.attach_to :active_record
|
data/lib/lograge/sql/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lograge-sql
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mattia Giuffrida
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-07-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|