fluent-logger 0.8.1 → 0.8.2

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
  SHA256:
3
- metadata.gz: 24cb776c1db25b7c798ad762556f420eb345721c93832e6b40f38d7e67b49c09
4
- data.tar.gz: bd6dc210af643d76189a5c3a2d86f953c9c68e49a2c4e037a3bd96b5d45e5a91
3
+ metadata.gz: 7be5ae39c39ebb27bdeeaa66b1d103cb6e7d8f7d6f0f5073ff5320c333345c37
4
+ data.tar.gz: 6f226c613086aff26729786e088a2923552fd02a8e28ebe88654d1dda068b98f
5
5
  SHA512:
6
- metadata.gz: c9eaec15cd63b3ceb83190c2748b23763f73f9a202c584011189c4f1941704830ac4cc04db317d49549748645a40a092f075be99601710ba1c1f659e0d4e91aa
7
- data.tar.gz: 238c085430cce8cad552598e3e5be31b14747b669831d427aab03d13b1fb9256ee68fb9fd1a0d8f9a3d6d813eb458317867c017403a87bc7ffbf1a65002275d8
6
+ metadata.gz: 53da0192645010cd5fe3ddc739ff4a6c5784ceb5ddbb8216b25ccd562a176606abfeeb5a9e164d0734e53467b69de749075136c07aebfa02e1da9babfb3f5e1b
7
+ data.tar.gz: db4c2283dc26641cdf4ac727ebb8815fa0e9ce3c0672b0e5bb98030aa83538005d653547551fa1ac954e591013ff1aaefbf1556905e5e4445479492e5b07b6a0
data/ChangeLog CHANGED
@@ -1,3 +1,8 @@
1
+ Release 0.8.2 - 2019/08/21
2
+
3
+ * Block timeout during IO#write to avoid writing invalid bytes
4
+ * Fluent::Logger::EventTime#to_json returns String
5
+
1
6
  Release 0.8.1 - 2019/05/30
2
7
 
3
8
  * Improve non-blocking write handling
@@ -134,4 +139,3 @@ Release 0.2.0 - 2011/08/05
134
139
  Release 0.1.0 - 2011/08/04
135
140
 
136
141
  * First release
137
-
data/README.md CHANGED
@@ -4,6 +4,22 @@
4
4
 
5
5
  A structured event logger
6
6
 
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ ```ruby
12
+ gem 'fluent-logger'
13
+ ```
14
+
15
+ And then execute:
16
+
17
+ $ bundle install
18
+
19
+ Or install it yourself as:
20
+
21
+ $ gem install fluent-logger
22
+
7
23
  ## Examples
8
24
 
9
25
  ### Simple
@@ -15,6 +15,7 @@
15
15
  # See the License for the specific language governing permissions and
16
16
  # limitations under the License.
17
17
  #
18
+ require 'timeout'
18
19
  require 'msgpack'
19
20
  require 'socket'
20
21
  require 'monitor'
@@ -44,7 +45,7 @@ module Fluent
44
45
  end
45
46
 
46
47
  def to_json(*args)
47
- @sec
48
+ @sec.to_s
48
49
  end
49
50
  end
50
51
 
@@ -260,7 +261,11 @@ module Fluent
260
261
  if @use_nonblock
261
262
  send_data_nonblock(data)
262
263
  else
263
- @con.write data
264
+ _, ws = IO.select([], [@con])
265
+ Thread.handle_interrupt(::Timeout::Error => :never) do
266
+ # block timeout error during IO#write
267
+ ws.first.write(data)
268
+ end
264
269
  end
265
270
  #while true
266
271
  # puts "sending #{data.length} bytes"
@@ -1,5 +1,5 @@
1
1
  module Fluent
2
2
  module Logger
3
- VERSION = '0.8.1'
3
+ VERSION = '0.8.2'
4
4
  end
5
5
  end
@@ -137,6 +137,16 @@ describe Fluent::Logger::FluentLogger do
137
137
  }
138
138
  end
139
139
 
140
+ context 'when the message has object which does not have #to_msgpack method' do
141
+ it 'success with nanosecond' do
142
+ expect(logger_with_nanosec.pending_bytesize).to eq(0)
143
+ expect(logger_with_nanosec.post('tag', 'a' => Errno::ETIMEDOUT)).to eq(true)
144
+ fluentd.wait_transfer
145
+ expect(fluentd.queue.last).to eq(['logger-test.tag', { 'a' => 'Errno::ETIMEDOUT' }])
146
+ expect(logger_with_nanosec.pending_bytesize).to eq(0)
147
+ end
148
+ end
149
+
140
150
  it ('close after post') {
141
151
  expect(logger).to be_connect
142
152
  logger.close
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fluent-logger
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.1
4
+ version: 0.8.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sadayuki Furuhashi
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-05-30 00:00:00.000000000 Z
11
+ date: 2019-08-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: msgpack