vx-lib-logger 0.3.5 → 0.3.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/vx/lib/logger/logstash_device.rb +17 -12
- data/lib/vx/lib/logger/version.rb +1 -1
- 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: 3340d7bb77543987056799ba4fcc7e4dbae644e0
|
4
|
+
data.tar.gz: 6796b3c63a27940229fbabaca2a0635fc85fa076
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5dc46049feeeeed35209d04eb75eedc967a437c34d12ae3b1d0f0c428463860f5275c04eb11674d4ba9dfbdce3b788be2d6e862672a8ad9499f95be417e377e5
|
7
|
+
data.tar.gz: 6144d060bf2b467c589d632f70c33887655afca47667cf1898370992cc80b51c9ec08363c75e302ba64213f5f9a07bddc398aeaf6a13a81cae5fcc41829756e0
|
@@ -26,25 +26,29 @@ module Vx ; module Lib ; module Logger
|
|
26
26
|
end
|
27
27
|
|
28
28
|
def close
|
29
|
-
@
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
29
|
+
@mutex.synchronize do
|
30
|
+
begin
|
31
|
+
@io && @io.close
|
32
|
+
rescue Exception => e
|
33
|
+
warn "#{self.class} - #{e.class} - #{e.message}"
|
34
|
+
ensure
|
35
|
+
@io = nil
|
36
|
+
end
|
37
|
+
end
|
34
38
|
end
|
35
39
|
|
36
40
|
def write(message)
|
37
41
|
if enabled?
|
38
|
-
|
39
|
-
|
40
|
-
@io.write message
|
41
|
-
end
|
42
|
+
with_connection do
|
43
|
+
@io.write message
|
42
44
|
end
|
43
45
|
end
|
44
46
|
end
|
45
47
|
|
46
48
|
def flush
|
47
|
-
@
|
49
|
+
@mutex.synchronize do
|
50
|
+
@io && @io.flush
|
51
|
+
end
|
48
52
|
end
|
49
53
|
|
50
54
|
private
|
@@ -62,12 +66,13 @@ module Vx ; module Lib ; module Logger
|
|
62
66
|
end
|
63
67
|
|
64
68
|
def with_connection(&block)
|
65
|
-
|
69
|
+
@mutex.synchronize do
|
70
|
+
connect unless connected?
|
71
|
+
end
|
66
72
|
yield
|
67
73
|
rescue Exception => e
|
68
74
|
warn "#{self.class} - #{e.class} - #{e.message}"
|
69
75
|
close
|
70
|
-
@io = nil
|
71
76
|
end
|
72
77
|
|
73
78
|
def reconnect
|