logjam_agent 0.35.0 → 0.35.1

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
  SHA256:
3
- metadata.gz: c22b624762a595ee627fba548bc5e41a3ac3a0180fdc8fa067969138963dd116
4
- data.tar.gz: ee6d22ec9272fea8c786e16ca7088c7711b258bf1e6a7dd665270a5e5b9a5b62
3
+ metadata.gz: 3f6c65ee6f965cad2efa823e0c7bbdc2445bcc03b5eb5b925a80a3cf5750440b
4
+ data.tar.gz: cfc487c0f873c6eeb63e90c2680c31394eb112231a9a8f17273864bf26f1f5a3
5
5
  SHA512:
6
- metadata.gz: aac5ad227a70fa16e232c01abb6cea2b4852d717a7b81dc681a137bbe91d71f3cf7fc23901fc280a6db65eece15ac6c1608bf22e140351a8436020ef80a7b1db
7
- data.tar.gz: d63f3d7758b328f01b2f4855c2dc9ef51cd1c1ed1152c900c46a942d389d38915d554ee732255c0ab946118209afbf528e47186a0d9825e1dfa351363615c3ab
6
+ metadata.gz: 9465b7e6caf9e029b6d68112829a5720f2ee3d3ffc31b53cf3331b24497a9c46f971f3cd30b683feba7022bb56066797fb18b8fc35bd2f542510fd2a9d844eb3
7
+ data.tar.gz: f5217174aaf9331df102b3a367d6e1d755cc2a689c8e778c7b676d8469e9ba32159b3c06d8d4dccdad956811f55ec86e50e6af935be698ad9f7bb0179b22aff6
@@ -2,9 +2,12 @@ module LogjamAgent
2
2
  module SelectiveLogging
3
3
  extend self
4
4
 
5
+ mattr_accessor :selective_logging_enabled
6
+ self.selective_logging_enabled = true
7
+
5
8
  def logjam_only
6
9
  old_selector = logjam_log_selector
7
- self.logjam_log_selector = :logjam_only
10
+ self.logjam_log_selector = :logjam_only if selective_logging_enabled
8
11
  yield
9
12
  ensure
10
13
  self.logjam_log_selector = old_selector
@@ -12,7 +15,7 @@ module LogjamAgent
12
15
 
13
16
  def logdevice_only
14
17
  old_selector = logjam_log_selector
15
- self.logjam_log_selector = :logdevice_only
18
+ self.logjam_log_selector = :logdevice_only if selective_logging_enabled
16
19
  yield
17
20
  ensure
18
21
  self.logjam_log_selector = old_selector
@@ -1,3 +1,3 @@
1
1
  module LogjamAgent
2
- VERSION = "0.35.0"
2
+ VERSION = "0.35.1"
3
3
  end
@@ -22,11 +22,12 @@ module LogjamAgent
22
22
 
23
23
  def teardown
24
24
  LogjamAgent.request = nil
25
+ LogjamAgent.selective_logging_enabled = true
25
26
  end
26
27
 
27
28
  def test_normal_logging_adds_line_to_request_and_logdevice
28
- assert !LogjamAgent.logjam_only?
29
- assert !LogjamAgent.logdevice_only?
29
+ refute LogjamAgent.logjam_only?
30
+ refute LogjamAgent.logdevice_only?
30
31
  @logger.info("normal")
31
32
  assert_equal 1, @lines.size
32
33
  assert_equal "normal", @lines.first.last
@@ -37,7 +38,7 @@ module LogjamAgent
37
38
  def test_logjam_only_logging_adds_line_to_request_but_not_to_logdevice
38
39
  LogjamAgent.logjam_only do
39
40
  assert LogjamAgent.logjam_only?
40
- assert !LogjamAgent.logdevice_only?
41
+ refute LogjamAgent.logdevice_only?
41
42
  @logger.info("logjam_only")
42
43
  end
43
44
  assert_equal 1, @lines.size
@@ -47,7 +48,7 @@ module LogjamAgent
47
48
 
48
49
  def test_logdevice_only_logging_adds_line_to_logdevice_but_not_to_request
49
50
  LogjamAgent.logdevice_only do
50
- assert !LogjamAgent.logjam_only?
51
+ refute LogjamAgent.logjam_only?
51
52
  assert LogjamAgent.logdevice_only?
52
53
  @logger.info("logdevice_only")
53
54
  end
@@ -55,5 +56,15 @@ module LogjamAgent
55
56
  assert_equal 1, @device.lines.size
56
57
  assert_match(/logdevice_only\n/, @device.lines.first)
57
58
  end
59
+
60
+ def test_select_logging_can_be_globally_disabled
61
+ LogjamAgent.selective_logging_enabled = false
62
+ LogjamAgent.logdevice_only do
63
+ refute LogjamAgent.logdevice_only?
64
+ end
65
+ LogjamAgent.logjam_only do
66
+ refute LogjamAgent.logjam_only?
67
+ end
68
+ end
58
69
  end
59
70
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logjam_agent
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.35.0
4
+ version: 0.35.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stefan Kaes