buffering_logger 2.0.3 → 2.0.4
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/logger.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: 2ec7a39f0dd57757106b2407dc76ee3a51f2efc4
|
4
|
+
data.tar.gz: a416626987ce0e312e1c4cd10280f280fbdc10e1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c6c31d2d11a5144ab790dd7eb4a5b71d61a8deb8e785e6e6729fbaa636bce52e1d6f6469096e840790294f05c6a563c9aa39d1dc1197b487624cadf15eaaa4dd
|
7
|
+
data.tar.gz: 5783ab6b1107dd7f92f9335a314eb835a49becf524d558b2fe90a146bb140f77ca946d9d48314d0a9391f579e4d00a4c3b8ba963a36920ad0f1511c7df0f291e
|
@@ -7,6 +7,8 @@ require 'logger'
|
|
7
7
|
module BufferingLogger
|
8
8
|
class Logger < ::Logger
|
9
9
|
|
10
|
+
attr_reader :raw_log_device
|
11
|
+
|
10
12
|
def initialize(logdev, shift_age: 0, shift_size: 1048576)
|
11
13
|
@shift_age, @shift_size = shift_age, shift_size
|
12
14
|
@opened_logdev = false
|
@@ -19,14 +21,12 @@ module BufferingLogger
|
|
19
21
|
def logdev=(logdev)
|
20
22
|
@logdev.close if @logdev && @opened_logdev
|
21
23
|
|
22
|
-
raw_log_device = LogDevice.new(logdev, shift_age: @shift_age, shift_size: @shift_size)
|
24
|
+
@raw_log_device = LogDevice.new(logdev, shift_age: @shift_age, shift_size: @shift_size)
|
23
25
|
|
24
26
|
# if we opened the logdev then we should close it when we're done
|
25
|
-
|
26
|
-
@opened_logdev = true
|
27
|
-
end
|
27
|
+
@opened_logdev = @raw_log_device.dev != logdev
|
28
28
|
|
29
|
-
@logdev = Buffer.new(raw_log_device)
|
29
|
+
@logdev = Buffer.new(@raw_log_device)
|
30
30
|
end
|
31
31
|
|
32
32
|
def buffered(transform: nil)
|