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 +4 -4
- data/lib/buffering_logger/buffer.rb +5 -5
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2627e4e5a241afc93803674003fc939934a4e927
|
4
|
+
data.tar.gz: b8f2b361b88ea9eca62874a6ac2738ae50640f70
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
23
|
+
@buffer.write(msg)
|
24
24
|
flush if !@buffering
|
25
25
|
end
|
26
26
|
|
27
27
|
def flush
|
28
|
-
if @buffer.
|
29
|
-
@logdev.write @buffer.
|
30
|
-
@buffer.
|
28
|
+
if @buffer.length > 0
|
29
|
+
@logdev.write @buffer.string
|
30
|
+
@buffer = StringIO.new
|
31
31
|
end
|
32
32
|
end
|
33
33
|
|