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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9fc76156b0ca24dee245c5b6681f03462a95cbc6
4
- data.tar.gz: 9120d85a12ad8d059e1a74afb24b5293d2b04ea1
3
+ metadata.gz: 3340d7bb77543987056799ba4fcc7e4dbae644e0
4
+ data.tar.gz: 6796b3c63a27940229fbabaca2a0635fc85fa076
5
5
  SHA512:
6
- metadata.gz: bd48fb6e83d24e0216a8db4cad894ad7c5bc3d54e153cf46458fb5472be1dfd8eea565b7e27dbd7031ca099272310aff9ef695d4765d2238bbeb13c5917f5f0e
7
- data.tar.gz: 8525d010e4f916d60c1e58ea8052f417748c47a93a3b1ee28cf63264b325803321969a40b427110250bdaaeaece39aa6439f126a61d747c26605c2554b5e2083
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
- @io && @io.close
30
- rescue Exception => e
31
- warn "#{self.class} - #{e.class} - #{e.message}"
32
- ensure
33
- @io = nil
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
- @mutex.synchronize do
39
- with_connection do
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
- @io && @io.flush
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
- connect unless connected?
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
@@ -1,7 +1,7 @@
1
1
  module Vx
2
2
  module Lib
3
3
  module Logger
4
- VERSION = "0.3.5"
4
+ VERSION = "0.3.6"
5
5
  end
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vx-lib-logger
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.5
4
+ version: 0.3.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dmitry Galinsky