fluent-logger 0.4.7 → 0.4.8

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 79e6006d4a147c6c52b987b487e585df98b05e4e
4
+ data.tar.gz: 7cb27442e72fc83776592c3dbf5c6ac857f4ee23
5
+ SHA512:
6
+ metadata.gz: 5569f59598c255e75b9908d9b2e06186f0d95f7c601324b2874d062b98bdf89f216f423136a9ec5b39f6f36a342519e415f7ba2b9647968b3019e05a0f80dc95
7
+ data.tar.gz: c0fd9d30beb244b380a24c08d70af4f4c58a04a1eec49dd2c20779f60676923f80cb895e4784a94bf26d56b0baf7e99febbd5eacc413977af08886c15f72db74
@@ -3,8 +3,16 @@ rvm:
3
3
  - 1.9.2
4
4
  - 1.9.3
5
5
  - 2.0.0
6
+ - 2.1.0
6
7
  - ree
8
+ - rbx
7
9
 
8
10
  before_install: git submodule update -i
9
11
 
10
12
  script: bundle exec rake spec
13
+
14
+ matrix:
15
+ allow_failures:
16
+ - rvm: 1.8.7
17
+ - rvm: ree
18
+ - rvm: rbx
data/ChangeLog CHANGED
@@ -1,3 +1,8 @@
1
+ Release 0.4.8 - 2014/04/12
2
+
3
+ * Use at_exit for logger finalization
4
+ * Fix unable to construct a default logger of non-default type
5
+
1
6
  Release 0.4.7 - 2013/11/21
2
7
 
3
8
  * Suppress log error message with :log_reconnect_error_threshold option
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.4.7
1
+ 0.4.8
@@ -26,25 +26,6 @@ module Logger
26
26
 
27
27
 
28
28
  class FluentLogger < LoggerBase
29
- module Finalizable
30
- require 'delegate'
31
- def new(*args, &block)
32
- obj = allocate
33
- obj.instance_eval { initialize(*args, &block) }
34
- dc = DelegateClass(obj.class).new(obj)
35
- ObjectSpace.define_finalizer(dc, finalizer(obj))
36
- dc
37
- end
38
-
39
- def finalizer(obj)
40
- fin = obj.method(:finalize)
41
- proc {|id|
42
- fin.call
43
- }
44
- end
45
- end
46
- extend Finalizable
47
-
48
29
  BUFFER_LIMIT = 8*1024*1024
49
30
  RECONNECT_WAIT = 0.5
50
31
  RECONNECT_WAIT_INCR_RATE = 1.5
@@ -55,7 +36,7 @@ class FluentLogger < LoggerBase
55
36
  r / RECONNECT_WAIT_INCR_RATE
56
37
  }
57
38
 
58
- def initialize(tag_prefix, *args)
39
+ def initialize(tag_prefix = '', *args)
59
40
  super()
60
41
 
61
42
  options = {
@@ -103,6 +84,8 @@ class FluentLogger < LoggerBase
103
84
  @logger.error "Failed to connect fluentd: #{$!}"
104
85
  @logger.error "Connection will be retried."
105
86
  end
87
+
88
+ at_exit { close }
106
89
  end
107
90
 
108
91
  attr_accessor :limit, :logger, :log_reconnect_error_threshold
@@ -139,10 +122,6 @@ class FluentLogger < LoggerBase
139
122
  !!@con
140
123
  end
141
124
 
142
- def finalize
143
- close
144
- end
145
-
146
125
  private
147
126
  def to_msgpack(msg)
148
127
  begin
@@ -20,7 +20,7 @@ module Logger
20
20
 
21
21
  class LoggerBase
22
22
  def self.open(*args, &block)
23
- Fluent::Logger.open(self, *args, &block)
23
+ Fluent::Logger.open(*args, &block)
24
24
  end
25
25
 
26
26
  def post(tag, map)
@@ -1,7 +1,7 @@
1
1
  module Fluent
2
2
  module Logger
3
3
 
4
- VERSION = '0.4.7'
4
+ VERSION = '0.4.8'
5
5
 
6
6
  end
7
7
  end
@@ -179,7 +179,7 @@ EOF
179
179
  it "backward compatible" do
180
180
  port = fluentd_port
181
181
  fluent_logger = Fluent::Logger::FluentLogger.new('logger-test', 'localhost', port)
182
- fluent_logger.method_missing(:instance_eval) { # fluent_logger is delegetor
182
+ fluent_logger.instance_eval {
183
183
  @host.should == 'localhost'
184
184
  @port.should == port
185
185
  }
@@ -191,7 +191,7 @@ EOF
191
191
  :host => 'localhost',
192
192
  :port => port
193
193
  })
194
- fluent_logger.method_missing(:instance_eval) { # fluent_logger is delegetor
194
+ fluent_logger.instance_eval {
195
195
  @host.should == 'localhost'
196
196
  @port.should == port
197
197
  }
@@ -227,16 +227,16 @@ EOF
227
227
  end
228
228
 
229
229
  it ('log connect error once') do
230
- logger.stub(:suppress_sec).and_return(-1)
230
+ Fluent::Logger::FluentLogger.any_instance.stub(:suppress_sec).and_return(-1)
231
231
  logger.log_reconnect_error_threshold = 1
232
- logger.should_receive(:log_reconnect_error).once.and_call_original
232
+ Fluent::Logger::FluentLogger.any_instance.should_receive(:log_reconnect_error).once.and_call_original
233
233
 
234
234
  logger.post('tag', {'a' => 'b'})
235
235
  wait_transfer # even if wait
236
236
  logger.post('tag', {'a' => 'b'})
237
237
  wait_transfer # even if wait
238
238
  logger_io.rewind
239
- logger_io.read.should =~ /Can't connect to/
239
+ logger_io.read.should =~ /Failed to connect/
240
240
  end
241
241
  end
242
242
  end
@@ -28,8 +28,7 @@ describe Fluent::Logger do
28
28
  Fluent::Logger.open('tag-prefix', {
29
29
  :logger => ::Logger.new(fluent_logger_logger_io)
30
30
  })
31
- # Fluent::Logger::FluentLogger is delegator
32
- Fluent::Logger.default.method_missing(:kind_of?, Fluent::Logger::FluentLogger).should be_true
31
+ Fluent::Logger.default.kind_of?(Fluent::Logger::FluentLogger).should be_true
33
32
  }
34
33
 
35
34
  it('open with BaseLogger class') {
metadata CHANGED
@@ -1,140 +1,127 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fluent-logger
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.7
5
- prerelease:
4
+ version: 0.4.8
6
5
  platform: ruby
7
6
  authors:
8
7
  - Sadayuki Furuhashi
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-11-21 00:00:00.000000000 Z
11
+ date: 2014-04-12 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: yajl-ruby
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
- - - ~>
17
+ - - "~>"
20
18
  - !ruby/object:Gem::Version
21
19
  version: '1.0'
22
20
  type: :runtime
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
- - - ~>
24
+ - - "~>"
28
25
  - !ruby/object:Gem::Version
29
26
  version: '1.0'
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: msgpack
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
- - - ! '>='
31
+ - - ">="
36
32
  - !ruby/object:Gem::Version
37
33
  version: 0.4.4
38
- - - ! '!='
34
+ - - "!="
39
35
  - !ruby/object:Gem::Version
40
36
  version: 0.5.0
41
- - - ! '!='
37
+ - - "!="
42
38
  - !ruby/object:Gem::Version
43
39
  version: 0.5.1
44
- - - ! '!='
40
+ - - "!="
45
41
  - !ruby/object:Gem::Version
46
42
  version: 0.5.2
47
- - - ! '!='
43
+ - - "!="
48
44
  - !ruby/object:Gem::Version
49
45
  version: 0.5.3
50
- - - <
46
+ - - "<"
51
47
  - !ruby/object:Gem::Version
52
48
  version: 0.6.0
53
49
  type: :runtime
54
50
  prerelease: false
55
51
  version_requirements: !ruby/object:Gem::Requirement
56
- none: false
57
52
  requirements:
58
- - - ! '>='
53
+ - - ">="
59
54
  - !ruby/object:Gem::Version
60
55
  version: 0.4.4
61
- - - ! '!='
56
+ - - "!="
62
57
  - !ruby/object:Gem::Version
63
58
  version: 0.5.0
64
- - - ! '!='
59
+ - - "!="
65
60
  - !ruby/object:Gem::Version
66
61
  version: 0.5.1
67
- - - ! '!='
62
+ - - "!="
68
63
  - !ruby/object:Gem::Version
69
64
  version: 0.5.2
70
- - - ! '!='
65
+ - - "!="
71
66
  - !ruby/object:Gem::Version
72
67
  version: 0.5.3
73
- - - <
68
+ - - "<"
74
69
  - !ruby/object:Gem::Version
75
70
  version: 0.6.0
76
71
  - !ruby/object:Gem::Dependency
77
72
  name: rake
78
73
  requirement: !ruby/object:Gem::Requirement
79
- none: false
80
74
  requirements:
81
- - - ! '>='
75
+ - - ">="
82
76
  - !ruby/object:Gem::Version
83
77
  version: 0.9.2
84
78
  type: :development
85
79
  prerelease: false
86
80
  version_requirements: !ruby/object:Gem::Requirement
87
- none: false
88
81
  requirements:
89
- - - ! '>='
82
+ - - ">="
90
83
  - !ruby/object:Gem::Version
91
84
  version: 0.9.2
92
85
  - !ruby/object:Gem::Dependency
93
86
  name: rspec
94
87
  requirement: !ruby/object:Gem::Requirement
95
- none: false
96
88
  requirements:
97
- - - ! '>='
89
+ - - ">="
98
90
  - !ruby/object:Gem::Version
99
91
  version: 2.7.0
100
92
  type: :development
101
93
  prerelease: false
102
94
  version_requirements: !ruby/object:Gem::Requirement
103
- none: false
104
95
  requirements:
105
- - - ! '>='
96
+ - - ">="
106
97
  - !ruby/object:Gem::Version
107
98
  version: 2.7.0
108
99
  - !ruby/object:Gem::Dependency
109
100
  name: simplecov
110
101
  requirement: !ruby/object:Gem::Requirement
111
- none: false
112
102
  requirements:
113
- - - ! '>='
103
+ - - ">="
114
104
  - !ruby/object:Gem::Version
115
105
  version: 0.5.4
116
106
  type: :development
117
107
  prerelease: false
118
108
  version_requirements: !ruby/object:Gem::Requirement
119
- none: false
120
109
  requirements:
121
- - - ! '>='
110
+ - - ">="
122
111
  - !ruby/object:Gem::Version
123
112
  version: 0.5.4
124
113
  - !ruby/object:Gem::Dependency
125
114
  name: timecop
126
115
  requirement: !ruby/object:Gem::Requirement
127
- none: false
128
116
  requirements:
129
- - - ! '>='
117
+ - - ">="
130
118
  - !ruby/object:Gem::Version
131
119
  version: 0.3.0
132
120
  type: :development
133
121
  prerelease: false
134
122
  version_requirements: !ruby/object:Gem::Requirement
135
- none: false
136
123
  requirements:
137
- - - ! '>='
124
+ - - ">="
138
125
  - !ruby/object:Gem::Version
139
126
  version: 0.3.0
140
127
  description: fluent logger for ruby
@@ -144,10 +131,10 @@ executables:
144
131
  extensions: []
145
132
  extra_rdoc_files: []
146
133
  files:
147
- - .gitignore
148
- - .gitmodules
149
- - .rspec
150
- - .travis.yml
134
+ - ".gitignore"
135
+ - ".gitmodules"
136
+ - ".rspec"
137
+ - ".travis.yml"
151
138
  - AUTHORS
152
139
  - COPYING
153
140
  - ChangeLog
@@ -177,33 +164,26 @@ files:
177
164
  - spec/test_logger_spec.rb
178
165
  homepage: https://github.com/fluent/fluent-logger-ruby
179
166
  licenses: []
167
+ metadata: {}
180
168
  post_install_message:
181
169
  rdoc_options: []
182
170
  require_paths:
183
171
  - lib
184
172
  required_ruby_version: !ruby/object:Gem::Requirement
185
- none: false
186
173
  requirements:
187
- - - ! '>='
174
+ - - ">="
188
175
  - !ruby/object:Gem::Version
189
176
  version: '0'
190
- segments:
191
- - 0
192
- hash: 3553729463111660525
193
177
  required_rubygems_version: !ruby/object:Gem::Requirement
194
- none: false
195
178
  requirements:
196
- - - ! '>='
179
+ - - ">="
197
180
  - !ruby/object:Gem::Version
198
181
  version: '0'
199
- segments:
200
- - 0
201
- hash: 3553729463111660525
202
182
  requirements: []
203
183
  rubyforge_project:
204
- rubygems_version: 1.8.23
184
+ rubygems_version: 2.2.2
205
185
  signing_key:
206
- specification_version: 3
186
+ specification_version: 4
207
187
  summary: fluent logger for ruby
208
188
  test_files:
209
189
  - spec/console_logger_spec.rb