buffering_logger 2.0.6 → 3.0.0

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: 5564a270f8f8b903262a250478cfca69a7854b7943aed6e4353b7589c5bf4a3a
4
- data.tar.gz: 74b1b8ac3d1d3a321c8064427966b47253c98968ba69f12fdd6e2b741989e924
3
+ metadata.gz: f49590098cb33d87ab8d0114a978908743fe30357604b07dad8e11f5ec999fc2
4
+ data.tar.gz: fab5895b8c82b7b08f7b50229eb6f6672afe07ea0ee832982e2637230c7f2b5c
5
5
  SHA512:
6
- metadata.gz: 29ed01af72ea3b3bc85446c3de71a48f2a48eed7716ff1a23c183fb8d5ba9ac9903fe969a04d8c337877562a9a0070ed1c245c27993228d05d9ae95cd876bea5
7
- data.tar.gz: ef3dae1d2d911160ba538a34b03afff8a1101dbdfde68f02530547a09d4290742caa60b7b9bac874ad3c0163c830d21df1cf595ed8a0c4ee1e44c8636d4b1c16
6
+ metadata.gz: 2e6e3304cacc56982a8c1348f8d6911013c6192230ed1e2b8fda53f668bdf76d526b206102877f1b33daa3e369a734f3d413d802f074f05e6e2a6e76f011c6fb
7
+ data.tar.gz: 3ab02da9c65ff13366f77f1b5935d5d4249357cc0110a71480c3041715f3b7d57454ac0de0009d4b49d1662445bc70bc18711a3e145901c4c1cdca5df12f8529
@@ -11,15 +11,15 @@ class BufferingLogger::Buffer
11
11
  # buffers during the block and then flushes.
12
12
  # returns the value of the block.
13
13
  def buffered(transform: nil)
14
- @buffering = true
14
+ self.buffering = true
15
15
  yield
16
16
  ensure
17
- @buffering = false
17
+ self.buffering = false
18
18
  flush(transform: transform)
19
19
  end
20
20
 
21
21
  def write(msg)
22
- if @buffering
22
+ if buffering
23
23
  buffer.write(msg)
24
24
  else
25
25
  logdev_write(msg)
@@ -62,4 +62,16 @@ class BufferingLogger::Buffer
62
62
  "buffering_logger_#{object_id}_buffer"
63
63
  end
64
64
 
65
+ def buffering
66
+ Thread.current[buffering_id]
67
+ end
68
+
69
+ def buffering=(val)
70
+ Thread.current[buffering_id] = val
71
+ end
72
+
73
+ def buffering_id
74
+ "buffering_logger_#{object_id}_is_buffering"
75
+ end
76
+
65
77
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: buffering_logger
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.6
4
+ version: 3.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jordan Brough