fluentd 0.10.36 → 0.10.37

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of fluentd might be problematic. Click here for more details.

@@ -1,7 +1,7 @@
1
1
  module Fluent
2
- DEFAULT_CONFIG_PATH = ENV['FLUENT_CONF'] || '/etc/fluent/fluent.conf'
3
- DEFAULT_PLUGIN_DIR = ENV['FLUENT_PLUGIN'] || '/etc/fluent/plugin'
4
- DEFAULT_SOCKET_PATH = ENV['FLUENT_SOCKET'] || '/var/run/fluent/fluent.sock'
5
- DEFAULT_LISTEN_PORT = 24224
6
- DEFAULT_FILE_PERMISSION = 0644
2
+ DEFAULT_CONFIG_PATH = ENV['FLUENT_CONF'] || '/etc/fluent/fluent.conf'
3
+ DEFAULT_PLUGIN_DIR = ENV['FLUENT_PLUGIN'] || '/etc/fluent/plugin'
4
+ DEFAULT_SOCKET_PATH = ENV['FLUENT_SOCKET'] || '/var/run/fluent/fluent.sock'
5
+ DEFAULT_LISTEN_PORT = 24224
6
+ DEFAULT_FILE_PERMISSION = 0644
7
7
  end
@@ -16,169 +16,165 @@
16
16
  # limitations under the License.
17
17
  #
18
18
  module Fluent
19
+ class EventStream
20
+ include Enumerable
19
21
 
22
+ def repeatable?
23
+ false
24
+ end
20
25
 
21
- class EventStream
22
- include Enumerable
23
-
24
- def repeatable?
25
- false
26
- end
27
-
28
- #def each(&block)
29
- #end
30
-
31
- def to_msgpack_stream
32
- out = ''
33
- each {|time,record|
34
- [time,record].to_msgpack(out)
35
- }
36
- out
37
- end
38
- end
39
-
40
-
41
- class OneEventStream < EventStream
42
- def initialize(time, record)
43
- @time = time
44
- @record = record
45
- end
46
-
47
- def repeatable?
48
- true
49
- end
50
-
51
- def each(&block)
52
- block.call(@time, @record)
53
- nil
54
- end
55
- end
56
-
57
-
58
- class ArrayEventStream < EventStream
59
- def initialize(entries)
60
- @entries = entries
61
- end
62
-
63
- def repeatable?
64
- true
65
- end
66
-
67
- def empty?
68
- @entries.empty?
69
- end
70
-
71
- def each(&block)
72
- @entries.each(&block)
73
- nil
74
- end
75
-
76
- #attr_reader :entries
77
- #
78
- #def to_a
79
- # @entries
80
- #end
81
- end
82
-
26
+ #def each(&block)
27
+ #end
83
28
 
84
- class MultiEventStream < EventStream
85
- def initialize
86
- @time_array = []
87
- @record_array = []
29
+ def to_msgpack_stream
30
+ out = ''
31
+ each {|time,record|
32
+ [time,record].to_msgpack(out)
33
+ }
34
+ out
35
+ end
88
36
  end
89
37
 
90
- def add(time, record)
91
- @time_array << time
92
- @record_array << record
93
- end
94
38
 
95
- def repeatable?
96
- true
97
- end
39
+ class OneEventStream < EventStream
40
+ def initialize(time, record)
41
+ @time = time
42
+ @record = record
43
+ end
98
44
 
99
- def empty?
100
- @time_array.empty?
101
- end
45
+ def repeatable?
46
+ true
47
+ end
102
48
 
103
- def each(&block)
104
- time_array = @time_array
105
- record_array = @record_array
106
- for i in 0..time_array.length-1
107
- block.call(time_array[i], record_array[i])
49
+ def each(&block)
50
+ block.call(@time, @record)
51
+ nil
108
52
  end
109
- nil
110
53
  end
111
- end
112
54
 
113
- if $use_msgpack_5
114
55
 
115
- class MessagePackEventStream < EventStream
116
- def initialize(data, cached_unpacker=nil)
117
- @data = data
56
+ class ArrayEventStream < EventStream
57
+ def initialize(entries)
58
+ @entries = entries
118
59
  end
119
60
 
120
61
  def repeatable?
121
62
  true
122
63
  end
123
64
 
65
+ def empty?
66
+ @entries.empty?
67
+ end
68
+
124
69
  def each(&block)
125
- # TODO format check
126
- unpacker = MessagePack::Unpacker.new
127
- unpacker.feed_each(@data, &block)
70
+ @entries.each(&block)
128
71
  nil
129
72
  end
130
73
 
131
- def to_msgpack_stream
132
- @data
133
- end
74
+ #attr_reader :entries
75
+ #
76
+ #def to_a
77
+ # @entries
78
+ #end
134
79
  end
135
80
 
136
- else # for 0.4.x. Will be removed after 0.5.x is stable
137
81
 
138
- class MessagePackEventStream < EventStream
139
- def initialize(data, cached_unpacker=nil)
140
- @data = data
141
- @unpacker = cached_unpacker || MessagePack::Unpacker.new
82
+ class MultiEventStream < EventStream
83
+ def initialize
84
+ @time_array = []
85
+ @record_array = []
86
+ end
87
+
88
+ def add(time, record)
89
+ @time_array << time
90
+ @record_array << record
142
91
  end
143
92
 
144
93
  def repeatable?
145
94
  true
146
95
  end
147
96
 
97
+ def empty?
98
+ @time_array.empty?
99
+ end
100
+
148
101
  def each(&block)
149
- @unpacker.reset
150
- # TODO format check
151
- @unpacker.feed_each(@data, &block)
102
+ time_array = @time_array
103
+ record_array = @record_array
104
+ for i in 0..time_array.length-1
105
+ block.call(time_array[i], record_array[i])
106
+ end
152
107
  nil
153
108
  end
109
+ end
154
110
 
155
- def to_msgpack_stream
156
- @data
111
+ if $use_msgpack_5
112
+
113
+ class MessagePackEventStream < EventStream
114
+ def initialize(data, cached_unpacker=nil)
115
+ @data = data
116
+ end
117
+
118
+ def repeatable?
119
+ true
120
+ end
121
+
122
+ def each(&block)
123
+ # TODO format check
124
+ unpacker = MessagePack::Unpacker.new
125
+ unpacker.feed_each(@data, &block)
126
+ nil
127
+ end
128
+
129
+ def to_msgpack_stream
130
+ @data
131
+ end
157
132
  end
158
- end
159
133
 
160
- end
134
+ else # for 0.4.x. Will be removed after 0.5.x is stable
161
135
 
162
- #class IoEventStream < EventStream
163
- # def initialize(io, num)
164
- # @io = io
165
- # @num = num
166
- # @u = MessagePack::Unpacker.new(@io)
167
- # end
168
- #
169
- # def repeatable?
170
- # false
171
- # end
172
- #
173
- # def each(&block)
174
- # return nil if @num == 0
175
- # @u.each {|obj|
176
- # block.call(obj[0], obj[1])
177
- # break if @array.size >= @num
178
- # }
179
- # end
180
- #end
136
+ class MessagePackEventStream < EventStream
137
+ def initialize(data, cached_unpacker=nil)
138
+ @data = data
139
+ @unpacker = cached_unpacker || MessagePack::Unpacker.new
140
+ end
181
141
 
142
+ def repeatable?
143
+ true
144
+ end
182
145
 
146
+ def each(&block)
147
+ @unpacker.reset
148
+ # TODO format check
149
+ @unpacker.feed_each(@data, &block)
150
+ nil
151
+ end
152
+
153
+ def to_msgpack_stream
154
+ @data
155
+ end
156
+ end
157
+
158
+ end
159
+
160
+ #class IoEventStream < EventStream
161
+ # def initialize(io, num)
162
+ # @io = io
163
+ # @num = num
164
+ # @u = MessagePack::Unpacker.new(@io)
165
+ # end
166
+ #
167
+ # def repeatable?
168
+ # false
169
+ # end
170
+ #
171
+ # def each(&block)
172
+ # return nil if @num == 0
173
+ # @u.each {|obj|
174
+ # block.call(obj[0], obj[1])
175
+ # break if @array.size >= @num
176
+ # }
177
+ # end
178
+ #end
183
179
  end
184
180
 
@@ -16,27 +16,23 @@
16
16
  # limitations under the License.
17
17
  #
18
18
  module Fluent
19
+ class Input
20
+ include Configurable
21
+ include PluginId
19
22
 
23
+ def initialize
24
+ super
25
+ end
20
26
 
21
- class Input
22
- include Configurable
23
- include PluginId
27
+ def configure(conf)
28
+ super
29
+ end
24
30
 
25
- def initialize
26
- super
27
- end
28
-
29
- def configure(conf)
30
- super
31
- end
32
-
33
- def start
34
- end
31
+ def start
32
+ end
35
33
 
36
- def shutdown
34
+ def shutdown
35
+ end
37
36
  end
38
37
  end
39
38
 
40
-
41
- end
42
-
@@ -18,6 +18,7 @@ require 'fluent/version'
18
18
  require 'fluent/log'
19
19
  require 'fluent/status'
20
20
  require 'fluent/config'
21
+ require 'fluent/config_dsl'
21
22
  require 'fluent/engine'
22
23
  require 'fluent/mixin'
23
24
  require 'fluent/process'
@@ -16,281 +16,277 @@
16
16
  # limitations under the License.
17
17
  #
18
18
  module Fluent
19
+ class Log
20
+ module TTYColor
21
+ RESET = "\033]R"
22
+ CRE = "\033[K"
23
+ CLEAR = "\033c"
24
+ NORMAL = "\033[0;39m"
25
+ RED = "\033[1;31m"
26
+ GREEN = "\033[1;32m"
27
+ YELLOW = "\033[1;33m"
28
+ BLUE = "\033[1;34m"
29
+ MAGENTA = "\033[1;35m"
30
+ CYAN = "\033[1;36m"
31
+ WHITE = "\033[1;37m"
32
+ end
19
33
 
34
+ LEVEL_TRACE = 0
35
+ LEVEL_DEBUG = 1
36
+ LEVEL_INFO = 2
37
+ LEVEL_WARN = 3
38
+ LEVEL_ERROR = 4
39
+ LEVEL_FATAL = 5
40
+
41
+ LEVEL_TEXT = %w(trace debug info warn error fatal)
42
+
43
+ def initialize(out=STDERR, level=LEVEL_TRACE)
44
+ @out = out
45
+ @level = level
46
+ @debug_mode = false
47
+ @self_event = false
48
+ @tag = 'fluent'
49
+ @time_format = '%Y-%m-%d %H:%M:%S %z '
50
+ enable_color out.tty?
51
+ # TODO: This variable name is unclear so we should change to better name.
52
+ @threads_exclude_events = []
53
+ end
20
54
 
21
- class Log
22
- module TTYColor
23
- RESET = "\033]R"
24
- CRE = "\033[K"
25
- CLEAR = "\033c"
26
- NORMAL = "\033[0;39m"
27
- RED = "\033[1;31m"
28
- GREEN = "\033[1;32m"
29
- YELLOW = "\033[1;33m"
30
- BLUE = "\033[1;34m"
31
- MAGENTA = "\033[1;35m"
32
- CYAN = "\033[1;36m"
33
- WHITE = "\033[1;37m"
34
- end
55
+ attr_accessor :out
56
+ attr_accessor :level
57
+ attr_accessor :tag
58
+ attr_accessor :time_format
35
59
 
36
- LEVEL_TRACE = 0
37
- LEVEL_DEBUG = 1
38
- LEVEL_INFO = 2
39
- LEVEL_WARN = 3
40
- LEVEL_ERROR = 4
41
- LEVEL_FATAL = 5
42
-
43
- LEVEL_TEXT = %w(trace debug info warn error fatal)
44
-
45
- def initialize(out=STDERR, level=LEVEL_TRACE)
46
- @out = out
47
- @level = level
48
- @debug_mode = false
49
- @self_event = false
50
- @tag = 'fluent'
51
- @time_format = '%Y-%m-%d %H:%M:%S %z '
52
- enable_color out.tty?
53
- # TODO: This variable name is unclear so we should change to better name.
54
- @threads_exclude_events = []
55
- end
60
+ def enable_debug(b=true)
61
+ @debug_mode = b
62
+ self
63
+ end
56
64
 
57
- attr_accessor :out
58
- attr_accessor :level
59
- attr_accessor :tag
60
- attr_accessor :time_format
65
+ def enable_event(b=true)
66
+ @self_event = b
67
+ self
68
+ end
61
69
 
62
- def enable_debug(b=true)
63
- @debug_mode = b
64
- self
65
- end
70
+ def enable_color(b=true)
71
+ if b
72
+ @color_trace = TTYColor::BLUE
73
+ @color_debug = TTYColor::WHITE
74
+ @color_info = TTYColor::GREEN
75
+ @color_warn = TTYColor::YELLOW
76
+ @color_error = TTYColor::MAGENTA
77
+ @color_fatal = TTYColor::RED
78
+ @color_reset = TTYColor::NORMAL
79
+ else
80
+ @color_trace = ''
81
+ @color_debug = ''
82
+ @color_info = ''
83
+ @color_warn = ''
84
+ @color_error = ''
85
+ @color_fatal = ''
86
+ @color_reset = ''
87
+ end
88
+ self
89
+ end
66
90
 
67
- def enable_event(b=true)
68
- @self_event = b
69
- self
70
- end
91
+ # If you want to suppress event emitting in specific thread, please use this method.
92
+ # Events in passed thread are never emitted.
93
+ def disable_events(thread)
94
+ @threads_exclude_events.push(thread) unless @threads_exclude_events.include?(thread)
95
+ end
71
96
 
72
- def enable_color(b=true)
73
- if b
74
- @color_trace = TTYColor::BLUE
75
- @color_debug = TTYColor::WHITE
76
- @color_info = TTYColor::GREEN
77
- @color_warn = TTYColor::YELLOW
78
- @color_error = TTYColor::MAGENTA
79
- @color_fatal = TTYColor::RED
80
- @color_reset = TTYColor::NORMAL
81
- else
82
- @color_trace = ''
83
- @color_debug = ''
84
- @color_info = ''
85
- @color_warn = ''
86
- @color_error = ''
87
- @color_fatal = ''
88
- @color_reset = ''
97
+ def on_trace(&block)
98
+ return if @level > LEVEL_TRACE
99
+ block.call if block
89
100
  end
90
- self
91
- end
92
101
 
93
- # If you want to suppress event emitting in specific thread, please use this method.
94
- # Events in passed thread are never emitted.
95
- def disable_events(thread)
96
- @threads_exclude_events.push(thread) unless @threads_exclude_events.include?(thread)
97
- end
102
+ def trace(*args, &block)
103
+ return if @level > LEVEL_TRACE
104
+ args << block.call if block
105
+ time, msg = event(:trace, args)
106
+ puts [@color_trace, caller_line(time, 1, LEVEL_TRACE), msg, @color_reset].join
107
+ end
108
+ alias TRACE trace
98
109
 
99
- def on_trace(&block)
100
- return if @level > LEVEL_TRACE
101
- block.call if block
102
- end
110
+ def trace_backtrace(backtrace=$!.backtrace)
111
+ return if @level > LEVEL_TRACE
112
+ time = Time.now
113
+ backtrace.each {|msg|
114
+ puts [" ", caller_line(time, 4, LEVEL_TRACE), msg].join
115
+ }
116
+ nil
117
+ end
103
118
 
104
- def trace(*args, &block)
105
- return if @level > LEVEL_TRACE
106
- args << block.call if block
107
- time, msg = event(:trace, args)
108
- puts [@color_trace, caller_line(time, 1, LEVEL_TRACE), msg, @color_reset].join
109
- end
110
- alias TRACE trace
111
-
112
- def trace_backtrace(backtrace=$!.backtrace)
113
- return if @level > LEVEL_TRACE
114
- time = Time.now
115
- backtrace.each {|msg|
116
- puts [" ", caller_line(time, 4, LEVEL_TRACE), msg].join
117
- }
118
- nil
119
- end
119
+ def on_debug(&block)
120
+ return if @level > LEVEL_DEBUG
121
+ block.call if block
122
+ end
120
123
 
121
- def on_debug(&block)
122
- return if @level > LEVEL_DEBUG
123
- block.call if block
124
- end
124
+ def debug(*args, &block)
125
+ return if @level > LEVEL_DEBUG
126
+ args << block.call if block
127
+ time, msg = event(:debug, args)
128
+ puts [@color_debug, caller_line(time, 1, LEVEL_DEBUG), msg, @color_reset].join
129
+ end
130
+ alias DEBUG debug
125
131
 
126
- def debug(*args, &block)
127
- return if @level > LEVEL_DEBUG
128
- args << block.call if block
129
- time, msg = event(:debug, args)
130
- puts [@color_debug, caller_line(time, 1, LEVEL_DEBUG), msg, @color_reset].join
131
- end
132
- alias DEBUG debug
133
-
134
- def debug_backtrace(backtrace=$!.backtrace)
135
- return if @level > LEVEL_DEBUG
136
- time = Time.now
137
- backtrace.each {|msg|
138
- puts [" ", caller_line(time, 4, LEVEL_DEBUG), msg].join
139
- }
140
- nil
141
- end
132
+ def debug_backtrace(backtrace=$!.backtrace)
133
+ return if @level > LEVEL_DEBUG
134
+ time = Time.now
135
+ backtrace.each {|msg|
136
+ puts [" ", caller_line(time, 4, LEVEL_DEBUG), msg].join
137
+ }
138
+ nil
139
+ end
142
140
 
143
- def on_info(&block)
144
- return if @level > LEVEL_INFO
145
- block.call if block
146
- end
141
+ def on_info(&block)
142
+ return if @level > LEVEL_INFO
143
+ block.call if block
144
+ end
147
145
 
148
- def info(*args, &block)
149
- return if @level > LEVEL_INFO
150
- args << block.call if block
151
- time, msg = event(:info, args)
152
- puts [@color_info, caller_line(time, 1, LEVEL_INFO), msg, @color_reset].join
153
- end
154
- alias INFO info
155
-
156
- def info_backtrace(backtrace=$!.backtrace)
157
- return if @level > LEVEL_INFO
158
- time = Time.now
159
- backtrace.each {|msg|
160
- puts [" ", caller_line(time, 4, LEVEL_INFO), msg].join
161
- }
162
- nil
163
- end
146
+ def info(*args, &block)
147
+ return if @level > LEVEL_INFO
148
+ args << block.call if block
149
+ time, msg = event(:info, args)
150
+ puts [@color_info, caller_line(time, 1, LEVEL_INFO), msg, @color_reset].join
151
+ end
152
+ alias INFO info
164
153
 
165
- def on_warn(&block)
166
- return if @level > LEVEL_WARN
167
- block.call if block
168
- end
154
+ def info_backtrace(backtrace=$!.backtrace)
155
+ return if @level > LEVEL_INFO
156
+ time = Time.now
157
+ backtrace.each {|msg|
158
+ puts [" ", caller_line(time, 4, LEVEL_INFO), msg].join
159
+ }
160
+ nil
161
+ end
169
162
 
170
- def warn(*args, &block)
171
- return if @level > LEVEL_WARN
172
- args << block.call if block
173
- time, msg = event(:warn, args)
174
- puts [@color_warn, caller_line(time, 1, LEVEL_WARN), msg, @color_reset].join
175
- end
176
- alias WARN warn
177
-
178
- def warn_backtrace(backtrace=$!.backtrace)
179
- return if @level > LEVEL_WARN
180
- time = Time.now
181
- backtrace.each {|msg|
182
- puts [" ", caller_line(time, 4, LEVEL_WARN), msg].join
183
- }
184
- nil
185
- end
163
+ def on_warn(&block)
164
+ return if @level > LEVEL_WARN
165
+ block.call if block
166
+ end
186
167
 
187
- def on_error(&block)
188
- return if @level > LEVEL_ERROR
189
- block.call if block
190
- end
168
+ def warn(*args, &block)
169
+ return if @level > LEVEL_WARN
170
+ args << block.call if block
171
+ time, msg = event(:warn, args)
172
+ puts [@color_warn, caller_line(time, 1, LEVEL_WARN), msg, @color_reset].join
173
+ end
174
+ alias WARN warn
191
175
 
192
- def error(*args, &block)
193
- return if @level > LEVEL_ERROR
194
- args << block.call if block
195
- time, msg = event(:error, args)
196
- puts [@color_error, caller_line(time, 1, LEVEL_ERROR), msg, @color_reset].join
197
- end
198
- alias ERROR error
199
-
200
- def error_backtrace(backtrace=$!.backtrace)
201
- return if @level > LEVEL_ERROR
202
- time = Time.now
203
- backtrace.each {|msg|
204
- puts [" ", caller_line(time, 4, LEVEL_ERROR), msg].join
205
- }
206
- nil
207
- end
176
+ def warn_backtrace(backtrace=$!.backtrace)
177
+ return if @level > LEVEL_WARN
178
+ time = Time.now
179
+ backtrace.each {|msg|
180
+ puts [" ", caller_line(time, 4, LEVEL_WARN), msg].join
181
+ }
182
+ nil
183
+ end
208
184
 
209
- def on_fatal(&block)
210
- return if @level > LEVEL_FATAL
211
- block.call if block
212
- end
185
+ def on_error(&block)
186
+ return if @level > LEVEL_ERROR
187
+ block.call if block
188
+ end
213
189
 
214
- def fatal(*args, &block)
215
- return if @level > LEVEL_FATAL
216
- args << block.call if block
217
- time, msg = event(:fatal, args)
218
- puts [@color_fatal, caller_line(time, 1, LEVEL_FATAL), msg, @color_reset].join
219
- end
220
- alias FATAL fatal
221
-
222
- def fatal_backtrace(backtrace=$!.backtrace)
223
- return if @level > LEVEL_FATAL
224
- time = Time.now
225
- backtrace.each {|msg|
226
- puts [" ", caller_line(time, 4, LEVEL_FATAL), msg].join
227
- }
228
- nil
229
- end
190
+ def error(*args, &block)
191
+ return if @level > LEVEL_ERROR
192
+ args << block.call if block
193
+ time, msg = event(:error, args)
194
+ puts [@color_error, caller_line(time, 1, LEVEL_ERROR), msg, @color_reset].join
195
+ end
196
+ alias ERROR error
230
197
 
231
- def puts(msg)
232
- @out.puts(msg)
233
- @out.flush
234
- msg
235
- rescue
236
- # FIXME
237
- nil
238
- end
198
+ def error_backtrace(backtrace=$!.backtrace)
199
+ return if @level > LEVEL_ERROR
200
+ time = Time.now
201
+ backtrace.each {|msg|
202
+ puts [" ", caller_line(time, 4, LEVEL_ERROR), msg].join
203
+ }
204
+ nil
205
+ end
239
206
 
240
- def write(data)
241
- @out.write(data)
242
- end
207
+ def on_fatal(&block)
208
+ return if @level > LEVEL_FATAL
209
+ block.call if block
210
+ end
243
211
 
244
- def flush
245
- @out.flush
246
- end
212
+ def fatal(*args, &block)
213
+ return if @level > LEVEL_FATAL
214
+ args << block.call if block
215
+ time, msg = event(:fatal, args)
216
+ puts [@color_fatal, caller_line(time, 1, LEVEL_FATAL), msg, @color_reset].join
217
+ end
218
+ alias FATAL fatal
247
219
 
248
- private
249
- def event(level, args)
250
- time = Time.now
251
- message = ''
252
- map = {}
253
- args.each {|a|
254
- if a.is_a?(Hash)
255
- a.each_pair {|k,v|
256
- map[k.to_s] = v
220
+ def fatal_backtrace(backtrace=$!.backtrace)
221
+ return if @level > LEVEL_FATAL
222
+ time = Time.now
223
+ backtrace.each {|msg|
224
+ puts [" ", caller_line(time, 4, LEVEL_FATAL), msg].join
225
+ }
226
+ nil
227
+ end
228
+
229
+ def puts(msg)
230
+ @out.puts(msg)
231
+ @out.flush
232
+ msg
233
+ rescue
234
+ # FIXME
235
+ nil
236
+ end
237
+
238
+ def write(data)
239
+ @out.write(data)
240
+ end
241
+
242
+ def flush
243
+ @out.flush
244
+ end
245
+
246
+ private
247
+ def event(level, args)
248
+ time = Time.now
249
+ message = ''
250
+ map = {}
251
+ args.each {|a|
252
+ if a.is_a?(Hash)
253
+ a.each_pair {|k,v|
254
+ map[k.to_s] = v
255
+ }
256
+ else
257
+ message << a.to_s
258
+ end
259
+ }
260
+
261
+ unless @threads_exclude_events.include?(Thread.current)
262
+ record = map.dup
263
+ record.keys.each {|key|
264
+ record[key] = record[key].inspect unless record[key].respond_to?(:to_msgpack)
257
265
  }
258
- else
259
- message << a.to_s
266
+ record['message'] = message.dup
267
+ Engine.push_log_event("#{@tag}.#{level}", time.to_i, record)
260
268
  end
261
- }
262
269
 
263
- unless @threads_exclude_events.include?(Thread.current)
264
- record = map.dup
265
- record.keys.each {|key|
266
- record[key] = record[key].inspect unless record[key].respond_to?(:to_msgpack)
270
+ map.each_pair {|k,v|
271
+ message << " #{k}=#{v.inspect}"
267
272
  }
268
- record['message'] = message.dup
269
- Engine.push_log_event("#{@tag}.#{level}", time.to_i, record)
270
- end
271
273
 
272
- map.each_pair {|k,v|
273
- message << " #{k}=#{v.inspect}"
274
- }
275
-
276
- return time, message
277
- end
274
+ return time, message
275
+ end
278
276
 
279
- def caller_line(time, depth, level)
280
- line = caller(depth+1)[0]
281
- log_msg = "#{time.strftime(@time_format)}[#{LEVEL_TEXT[level]}]: "
282
- if @debug_mode
283
- if match = /^(.+?):(\d+)(?::in `(.*)')?/.match(line)
284
- file = match[1].split('/')[-2,2].join('/')
285
- line = match[2]
286
- method = match[3]
287
- return "#{log_msg}#{file}:#{line}:#{method}: "
277
+ def caller_line(time, depth, level)
278
+ line = caller(depth+1)[0]
279
+ log_msg = "#{time.strftime(@time_format)}[#{LEVEL_TEXT[level]}]: "
280
+ if @debug_mode
281
+ if match = /^(.+?):(\d+)(?::in `(.*)')?/.match(line)
282
+ file = match[1].split('/')[-2,2].join('/')
283
+ line = match[2]
284
+ method = match[3]
285
+ return "#{log_msg}#{file}:#{line}:#{method}: "
286
+ end
288
287
  end
288
+ return log_msg
289
289
  end
290
- return log_msg
291
290
  end
292
291
  end
293
292
 
294
-
295
- end
296
-