buffering_logger 1.0.0 → 1.0.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
  SHA1:
3
- metadata.gz: cd136895dcc57b5a55668e5667661afc9f2862cc
4
- data.tar.gz: 2a6ff2532bb7c27445504613947d919fcc6c3680
3
+ metadata.gz: 2627e4e5a241afc93803674003fc939934a4e927
4
+ data.tar.gz: b8f2b361b88ea9eca62874a6ac2738ae50640f70
5
5
  SHA512:
6
- metadata.gz: d29f06ff7715d96976cf797740c8c10e4494d4bc1b5026d2fb08e2b3cd5049d1ef81f2cb069731d878895461fb2fc2b02355fd8e7b03bc80ed4d5303bcbd7229
7
- data.tar.gz: 41cba79ea6091ae71cf3099268490a223cbc39a03f4f99faba2c4d39e950c6c341bf498f565a063d96fbc184346a220ca8c0c06a46557d2811454008f71991df
6
+ metadata.gz: 5f3d295ea1a19b7b378f7c01e398a4abb6f2f0f2116b9fd56f2f69986e868603e6fea6dc760e4835b166d8cda1157fc2c7bffa319f902c41eb57e5f40e9659ab
7
+ data.tar.gz: e4377a98763f6da7d9419b7904af2208f1a67e8baf2d5558b43ad567afe2eb6152d403894f2d8375d198582d81fa033051716900429cfc4186c806177a5f149c
@@ -5,7 +5,7 @@ module BufferingLogger
5
5
  class Buffer
6
6
  def initialize(logdev)
7
7
  @logdev = logdev
8
- @buffer = []
8
+ @buffer = StringIO.new
9
9
  end
10
10
 
11
11
  # buffers during the block and then flushes.
@@ -20,14 +20,14 @@ module BufferingLogger
20
20
  end
21
21
 
22
22
  def write(msg)
23
- @buffer << msg
23
+ @buffer.write(msg)
24
24
  flush if !@buffering
25
25
  end
26
26
 
27
27
  def flush
28
- if @buffer.any?
29
- @logdev.write @buffer.join
30
- @buffer.clear
28
+ if @buffer.length > 0
29
+ @logdev.write @buffer.string
30
+ @buffer = StringIO.new
31
31
  end
32
32
  end
33
33
 
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: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jordan Brough