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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 731f331a434fe08296dac04c2b5220521f06163c
4
- data.tar.gz: b50f15e84035e9dc56bcbb5644ad8893e9673cd6
3
+ metadata.gz: f1ba128f4d79fc06037d037b0c06015d002c4d44
4
+ data.tar.gz: 9a9c2216b9ff43d8b76a3f5cfc9bc3c9678432a3
5
5
  SHA512:
6
- metadata.gz: c0114fdb00a7a7abe49218a689ca57c921a21a833965537c438e1074baf1bc654d8fff6f48f3117737093fddd69c07c2f4f4fcfffd463e9cf38a2c1c2e8d3792
7
- data.tar.gz: 67725f27c6d721f0c6f029d1c6ff2552cc1b7e83c1779323240208833f1d8ad9ffc86ed9ac2edd82cb1079ab5d399ae28ac807e5bb95d6e9d90dc09885aeb45d
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)
@@ -1,6 +1,7 @@
1
1
  module EffectiveLogging
2
2
  class EmailLogger
3
3
  def self.delivering_email(message)
4
+ return if EffectiveLogging.supressed?
4
5
  return unless message.present?
5
6
 
6
7
  # collect a Hash of arguments used to invoke EffectiveLogger.success
@@ -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
 
@@ -1,3 +1,3 @@
1
1
  module EffectiveLogging
2
- VERSION = '2.0.4'.freeze
2
+ VERSION = '2.0.5'.freeze
3
3
  end
@@ -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
- @supressed = true; yield; @supressed = false
42
+ @@supressed = true; yield; @@supressed = false
41
43
  end
42
44
 
43
45
  def self.supressed?
44
- @supressed == true
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
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-05 00:00:00.000000000 Z
11
+ date: 2018-04-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails