effective_logging 2.0.4 → 2.0.5
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/app/models/concerns/acts_as_loggable.rb +3 -3
- data/app/models/effective_logger.rb +2 -0
- data/lib/effective_logging/email_logger.rb +1 -0
- data/lib/effective_logging/log_page_views.rb +1 -0
- data/lib/effective_logging/version.rb +1 -1
- data/lib/effective_logging.rb +4 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f1ba128f4d79fc06037d037b0c06015d002c4d44
|
4
|
+
data.tar.gz: 9a9c2216b9ff43d8b76a3f5cfc9bc3c9678432a3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7d96199220b976d3ff56404ea876c8c9c8cb6f698208ce5bf68a41d02d21f401d2e3039f51e14ff461d3625ee3b724d30a77bd3794b83bf828d19bf74138068a
|
7
|
+
data.tar.gz: 825459508411e0fdd5098a035e8631af3c97ce818b12a830ba661786a34e2606beb609747ada0f9b3117c886d6b4859ad64b83f7fecf7f1ce6c9d5f874bc3ec8
|
@@ -20,7 +20,7 @@ module ActsAsLoggable
|
|
20
20
|
included do
|
21
21
|
has_many :logged_changes, -> { order(:id).where(status: EffectiveLogging.log_changes_status) }, as: :associated, class_name: 'Effective::Log'
|
22
22
|
|
23
|
-
around_save do |_, block|
|
23
|
+
around_save(unless: -> { EffectiveLogging.supressed? }) do |_, block|
|
24
24
|
@acts_as_loggable_new_record = new_record?
|
25
25
|
|
26
26
|
unless @acts_as_loggable_new_record
|
@@ -31,13 +31,13 @@ module ActsAsLoggable
|
|
31
31
|
true
|
32
32
|
end
|
33
33
|
|
34
|
-
before_destroy do
|
34
|
+
before_destroy(unless: -> { EffectiveLogging.supressed? }) do
|
35
35
|
@acts_as_loggable_destroy_record = true
|
36
36
|
::EffectiveLogging::ActiveRecordLogger.new(self, log_changes_options).destroyed!
|
37
37
|
true
|
38
38
|
end
|
39
39
|
|
40
|
-
after_commit do
|
40
|
+
after_commit(unless: -> { EffectiveLogging.supressed? }) do
|
41
41
|
if @acts_as_loggable_new_record
|
42
42
|
::EffectiveLogging::ActiveRecordLogger.new(self, log_changes_options).created!
|
43
43
|
elsif !@acts_as_loggable_destroy_record && @acts_as_loggable_update_record
|
@@ -2,6 +2,8 @@
|
|
2
2
|
|
3
3
|
class EffectiveLogger
|
4
4
|
def self.log(message, status = EffectiveLogging.statuses.first, options = {})
|
5
|
+
return if EffectiveLogging.supressed?
|
6
|
+
|
5
7
|
options = Hash(options).delete_if { |k, v| v.blank? }
|
6
8
|
|
7
9
|
if options[:user].present? && !options[:user].kind_of?(User)
|
@@ -35,6 +35,7 @@ module EffectiveLogging
|
|
35
35
|
|
36
36
|
module InstanceMethods
|
37
37
|
def effective_logging_log_page_view
|
38
|
+
return if EffectiveLogging.supressed?
|
38
39
|
return if @_effective_logging_skip_log_page_view == true
|
39
40
|
return if (self.class.log_page_views_opts[:skip_namespace] || []).include?(self.class.parent)
|
40
41
|
|
data/lib/effective_logging.rb
CHANGED
@@ -15,6 +15,8 @@ module EffectiveLogging
|
|
15
15
|
mattr_accessor :sign_in_enabled
|
16
16
|
mattr_accessor :sign_out_enabled
|
17
17
|
|
18
|
+
mattr_accessor :supressed
|
19
|
+
|
18
20
|
def self.setup
|
19
21
|
yield self
|
20
22
|
end
|
@@ -37,11 +39,11 @@ module EffectiveLogging
|
|
37
39
|
end
|
38
40
|
|
39
41
|
def self.supressed(&block)
|
40
|
-
|
42
|
+
@@supressed = true; yield; @@supressed = false
|
41
43
|
end
|
42
44
|
|
43
45
|
def self.supressed?
|
44
|
-
|
46
|
+
@@supressed == true
|
45
47
|
end
|
46
48
|
|
47
49
|
def self.statuses
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: effective_logging
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Code and Effect
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-04-
|
11
|
+
date: 2018-04-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|