rails-flog 1.3.0 → 1.3.1
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/README.md +3 -2
- data/lib/flog/params_formattable.rb +11 -3
- data/lib/flog/sql_formattable.rb +9 -3
- data/lib/flog/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 37349e66f4eac2a3c918f1f5dd3a0575be741be1
|
4
|
+
data.tar.gz: 44b49c742fcf58e324a7406fa151c9b8248b0dde
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 79f8fa25feaae28b230481ead671bdcfb8e4a6b7c367ddf255dd76e6e047e3f320b62f179e920aae46d9c96edc5aaf6501e59dc8d15260410c8b40e450a17de8
|
7
|
+
data.tar.gz: a51ab46561f273ffd74fe9c2cd50e1ac11e3e5c9e20a6af8b81721397a47531ef50b739568596a4aca7a4135e86297e7d14e997dd96ff92a3a95577fc9cdba45
|
data/README.md
CHANGED
@@ -115,7 +115,8 @@ end
|
|
115
115
|
|
116
116
|
## Disable temporary
|
117
117
|
|
118
|
-
If you put a file to `<rails_app>/tmp` direcotry, `rails-flog` will disable format.
|
118
|
+
If you put a file to `<rails_app>/tmp` direcotry, `rails-flog` will disable format.
|
119
|
+
Priority of this feature is higher than configurations.
|
119
120
|
|
120
121
|
|File name |Feature |
|
121
122
|
|:------------------|:----------|
|
@@ -143,4 +144,4 @@ If you put a file to `<rails_app>/tmp` direcotry, `rails-flog` will disable form
|
|
143
144
|
- v1.1.1 (2013-12-06 JST): Change to alias_method_change from alias for method aliasing
|
144
145
|
- v1.2.0 (2014-01-14 JST): Add feature that disables format partially by no-flog-sql.txt and no-flog-params.txt
|
145
146
|
- v1.3.0 (2014-01-26 JST): Add configuration
|
146
|
-
|
147
|
+
- v1.3.1 (2014-01-27 JST): Refactored
|
@@ -41,10 +41,18 @@ class ActionController::LogSubscriber
|
|
41
41
|
def formattable?(event)
|
42
42
|
return false unless Flog::Status.params_formattable?
|
43
43
|
|
44
|
-
if
|
45
|
-
|
46
|
-
|
44
|
+
return true if force_format_by_nested_params?(event)
|
45
|
+
|
46
|
+
key_count_over?(event)
|
47
|
+
end
|
48
|
+
|
49
|
+
def force_format_by_nested_params?(event)
|
50
|
+
return false unless Flog.config.force_on_nested_params?
|
51
|
+
|
52
|
+
event.payload[:params].values.any? { |value| value.is_a?(Hash) }
|
53
|
+
end
|
47
54
|
|
55
|
+
def key_count_over?(event)
|
48
56
|
threshold = Flog.config.params_key_count_threshold.to_i
|
49
57
|
threshold += 1 if event.payload[:params].keys.include?("controller")
|
50
58
|
threshold += 1 if event.payload[:params].keys.include?("action")
|
data/lib/flog/sql_formattable.rb
CHANGED
@@ -33,10 +33,16 @@ class ActiveRecord::LogSubscriber
|
|
33
33
|
def formattable?(event)
|
34
34
|
return false unless Flog::Status.sql_formattable?
|
35
35
|
|
36
|
-
|
37
|
-
|
38
|
-
|
36
|
+
return false if ignore_by_cached_query?(event)
|
37
|
+
|
38
|
+
duration_over?(event)
|
39
|
+
end
|
40
|
+
|
41
|
+
def ignore_by_cached_query?(event)
|
42
|
+
event.payload[:name] == "CACHE" && Flog.config.ignore_cached_query?
|
43
|
+
end
|
39
44
|
|
45
|
+
def duration_over?(event)
|
40
46
|
event.duration >= Flog.config.query_duration_threshold.to_f
|
41
47
|
end
|
42
48
|
end
|
data/lib/flog/version.rb
CHANGED