lwes-logger 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
data/.autotest ADDED
@@ -0,0 +1,23 @@
1
+ # -*- ruby -*-
2
+
3
+ require 'autotest/restart'
4
+
5
+ # Autotest.add_hook :initialize do |at|
6
+ # at.extra_files << "../some/external/dependency.rb"
7
+ #
8
+ # at.libs << ":../some/external"
9
+ #
10
+ # at.add_exception 'vendor'
11
+ #
12
+ # at.add_mapping(/dependency.rb/) do |f, _|
13
+ # at.files_matching(/test_.*rb$/)
14
+ # end
15
+ #
16
+ # %w(TestA TestB).each do |klass|
17
+ # at.extra_class_map[klass] = "test/test_misc.rb"
18
+ # end
19
+ # end
20
+
21
+ # Autotest.add_hook :run_command do |at|
22
+ # system "rake build"
23
+ # end
data/History.txt ADDED
@@ -0,0 +1,6 @@
1
+ === 1.0.0 / 2010-10-05
2
+
3
+ * 1 major enhancement
4
+
5
+ * Birthday!
6
+
data/Manifest.txt ADDED
@@ -0,0 +1,7 @@
1
+ .autotest
2
+ History.txt
3
+ Manifest.txt
4
+ README.txt
5
+ Rakefile
6
+ lib/lwes_logger.rb
7
+ test/test_lwes_logger.rb
data/README.txt ADDED
@@ -0,0 +1,156 @@
1
+ = lwes-logger
2
+
3
+ * http://github.com/yaksnrainbows/lwes-logger
4
+
5
+ == DESCRIPTION:
6
+
7
+ Lwes based ruby logger for real-time logging.
8
+
9
+ == FEATURES:
10
+
11
+ * Send logging udp events with lwes.
12
+
13
+ * Optionally also log to a local file.
14
+
15
+ == SYNOPSIS:
16
+
17
+ require 'lwes_logger'
18
+
19
+ logger = LwesLogger.new '127.0.0.1',
20
+ :log_device => "optional_backup_logfile.logs"
21
+
22
+ logger.namespace = "MyApp::Logs"
23
+
24
+ logger.meta_event.merge! :app_name => "myapp",
25
+ :user => `whoami`
26
+
27
+ logger.debug "This is a debug log event"
28
+ logger.error "OH NOES!"
29
+
30
+ Will produce logs in the optional_backup_logfile.logs file and will
31
+ generate the following Lwes events:
32
+
33
+ System::Startup[3]
34
+ {
35
+ SenderPort = 64885;
36
+ ReceiptTime = 1286495516997;
37
+ SenderIP = 127.0.0.1;
38
+ }
39
+ MyApp::Logs::Full[12]
40
+ {
41
+ SenderPort = 64885;
42
+ message = This is a debug log event;
43
+ progname = This is a debug log event;
44
+ event_id = MyApp::Logs::Debug-3bd9c9d2-d272-11df-b9a6-00254bfffeb1;
45
+ app_name = myapp;
46
+ user = system_user;
47
+ ReceiptTime = 1286495519612;
48
+ SenderIP = 127.0.0.1;
49
+ timestamp = Oct 07 16:51:59;
50
+ hostname = example.com;
51
+ severity = DEBUG;
52
+ pid = 70884;
53
+ }
54
+ MyApp::Logs::Debug[12]
55
+ {
56
+ SenderPort = 64885;
57
+ message = This is a debug log event;
58
+ progname = This is a debug log event;
59
+ event_id = MyApp::Logs::Debug-3bd9c9d2-d272-11df-b9a6-00254bfffeb1;
60
+ app_name = myapp;
61
+ user = system_user;
62
+ ReceiptTime = 1286495519612;
63
+ SenderIP = 127.0.0.1;
64
+ timestamp = Oct 07 16:51:59;
65
+ hostname = example.com;
66
+ severity = DEBUG;
67
+ pid = 70884;
68
+ }
69
+ MyApp::Logs::Full[12]
70
+ {
71
+ SenderPort = 64885;
72
+ message = OH NOES!;
73
+ progname = OH NOES!;
74
+ event_id = MyApp::Logs::Error-3a38b5f6-d273-11df-b9a6-00254bfffeb1;
75
+ app_name = myapp;
76
+ user = system_user;
77
+ ReceiptTime = 1286495519612;
78
+ SenderIP = 127.0.0.1;
79
+ timestamp = Oct 07 16:51:59;
80
+ hostname = example.com;
81
+ severity = ERROR;
82
+ pid = 70884;
83
+ }
84
+ MyApp::Logs::Error[12]
85
+ {
86
+ SenderPort = 64885;
87
+ message = OH NOES!;
88
+ progname = OH NOES!;
89
+ event_id = MyApp::Logs::Error-3a38b5f6-d273-11df-b9a6-00254bfffeb1;
90
+ app_name = myapp;
91
+ user = system_user;
92
+ ReceiptTime = 1286495519612;
93
+ SenderIP = 127.0.0.1;
94
+ timestamp = Oct 07 16:51:59;
95
+ hostname = example.com;
96
+ severity = ERROR;
97
+ pid = 70884;
98
+ }
99
+ System::Shutdown[7]
100
+ {
101
+ freq = 145;
102
+ SenderPort = 64885;
103
+ seq = 0;
104
+ ReceiptTime = 1286495661890;
105
+ total = 0;
106
+ SenderIP = 127.0.0.1;
107
+ count = 0;
108
+ }
109
+
110
+ Notice that for convenience, logs events are broadcast to both the Full and
111
+ Severity (e.g. Debug) events. You can change the name of the full logs by
112
+ setting the full_logs_event attribute to a string, or turn full logs off
113
+ completely by setting it to false:
114
+
115
+ logger.full_logs_event = "OtherFullLogs"
116
+ logger.full_logs_event = false
117
+
118
+ Alternatively, if you'd rather only have full logs you can assign the
119
+ full_logs_only attribute:
120
+
121
+ logger.full_logs_only = true
122
+
123
+ == REQUIREMENTS:
124
+
125
+ * lwes gem
126
+
127
+ * uuidtools gem
128
+
129
+ == INSTALL:
130
+
131
+ * sudo gem install lwes-logger
132
+
133
+ == LICENSE:
134
+
135
+ (The MIT License)
136
+
137
+ Copyright (c) 2010 Jeremie Castagna
138
+
139
+ Permission is hereby granted, free of charge, to any person obtaining
140
+ a copy of this software and associated documentation files (the
141
+ 'Software'), to deal in the Software without restriction, including
142
+ without limitation the rights to use, copy, modify, merge, publish,
143
+ distribute, sublicense, and/or sell copies of the Software, and to
144
+ permit persons to whom the Software is furnished to do so, subject to
145
+ the following conditions:
146
+
147
+ The above copyright notice and this permission notice shall be
148
+ included in all copies or substantial portions of the Software.
149
+
150
+ THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
151
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
152
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
153
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
154
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
155
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
156
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/Rakefile ADDED
@@ -0,0 +1,15 @@
1
+ # -*- ruby -*-
2
+
3
+ require 'rubygems'
4
+ require 'hoe'
5
+
6
+ Hoe.spec 'lwes-logger' do
7
+ developer('Jeremie Castagna', 'jcastagna@attinteractive.com')
8
+
9
+ self.extra_deps << ['lwes', '~> 0.6']
10
+ self.extra_deps << ['uuidtools', '~> 2.1']
11
+
12
+ self.extra_dev_deps << ['flexmock', '>=0.8.7']
13
+ end
14
+
15
+ # vim: syntax=ruby
@@ -0,0 +1,181 @@
1
+ require 'socket'
2
+ require 'logger'
3
+
4
+ require 'rubygems'
5
+ require 'lwes'
6
+ require 'uuidtools'
7
+
8
+ ##
9
+ # Lwes based ruby logger for real-time logging.
10
+
11
+ class LwesLogger < Logger
12
+
13
+ VERSION = '1.0.0'
14
+
15
+ HOSTNAME = Socket.gethostname
16
+ FORMAT = "%s [%s#%d] %5s -- %s: %s\n"
17
+ DATETIME_FORMAT = "%b %d %H:%M:%S"
18
+
19
+
20
+ # The default event data to pass along with the lwes event.
21
+ attr_reader :meta_event
22
+
23
+ # The name of the event to emit all severity types to.
24
+ # Will not emit to the full logs event if set to nil or false.
25
+ # Defaults to "Full"
26
+ attr_accessor :full_logs_event
27
+
28
+ # Don't segregate by severity and only emit events to Namespace::Full.
29
+ # Defaults to false.
30
+ attr_accessor :full_logs_only
31
+
32
+ # Base lwes namespace for events.
33
+ attr_reader :namespace
34
+
35
+ # The lwes event emitter.
36
+ attr_reader :emitter
37
+
38
+ # Format of the timestamp in the lwes events.
39
+ # Note: If using a custom formatter, this property will only
40
+ # apply to lwes events. Defaults to DATETIME_FORMAT.
41
+ attr_accessor :datetime_format
42
+
43
+
44
+ ##
45
+ # Creates a new LwesLogger. Supports the following options:
46
+ # :log_device:: Supports the same arguments as Logger.new - default: nil
47
+ # :namespace:: Lwes root event namespace - default: "LwesLogger"
48
+ # :datetime_format:: Timestamp format in lwes logs - default: DATETIME_FORMAT
49
+ # :iface:: Forwarded to LWES::Event.new - default: "0.0.0.0"
50
+ # :port:: Forwarded to LWES::Event.new - default: 12345
51
+ # :heartbeat:: Forwarded to LWES::Event.new - default: 1
52
+ # :ttl:: Forwarded to LWES::Event.new - default: 1
53
+
54
+
55
+ def initialize ip_address, options={}
56
+ args = [options[:log_device]].flatten
57
+ super(*args)
58
+
59
+ @meta_event = {
60
+ :hostname => HOSTNAME,
61
+ :pid => $$.to_s
62
+ }
63
+
64
+ @datetime_format = options[:datetime_format] || DATETIME_FORMAT
65
+
66
+ @full_logs_event = "Full"
67
+ @full_logs_only = false
68
+
69
+ @formatter = method(:call_format)
70
+ @namespace = camelize options[:namespace] || "LwesLogger"
71
+ @emitter = lwes_emitter ip_address, options
72
+ end
73
+
74
+
75
+ ##
76
+ # Dump given message to the log device without any formatting.
77
+ # Creates an LwesLogger::Any event.
78
+
79
+ def << msg
80
+ emit_log nil, msg
81
+ super
82
+ end
83
+
84
+
85
+ ##
86
+ # Log to both lwes and the log device, if given.
87
+
88
+ def add severity, message=nil, progname=nil, &block
89
+ return true if severity < @level
90
+
91
+ emit_log severity, message, progname, &block
92
+ super
93
+ end
94
+
95
+ alias log add
96
+
97
+
98
+ ##
99
+ # Emits an lwes logging event. Setting the data argument will
100
+ # pass additional data to the emitted event.
101
+
102
+ def emit_log severity, message=nil, progname=nil, data={}, &block
103
+ event_hash = build_log_event severity, message, progname, data, &block
104
+
105
+ dump_event = [@namespace, @full_logs_event].join("::")
106
+ @emitter.emit dump_event, event_hash if @full_logs_event
107
+
108
+ event_name = [@namespace, event_hash[:severity].capitalize].join("::")
109
+ @emitter.emit event_name, event_hash unless @full_logs_only
110
+ end
111
+
112
+
113
+ ##
114
+ # Creates an lwes event hash with log data.
115
+
116
+ def build_log_event severity, message=nil, progname=nil, data={}, &block
117
+ severity ||= UNKNOWN
118
+ severity = format_severity(severity)
119
+
120
+ progname ||= @progname
121
+ message ||= block.call if block_given?
122
+ message ||= progname
123
+
124
+ event_id =
125
+ "#{@namespace}::#{severity.capitalize}-" +
126
+ UUIDTools::UUID.timestamp_create.to_s
127
+
128
+ event_hash = @meta_event.merge \
129
+ :message => message.to_s.gsub(/\e\[.*?m/, ''),
130
+ :progname => progname.to_s,
131
+ :severity => severity,
132
+ :timestamp => Time.now.strftime(@datetime_format),
133
+ :event_id => event_id
134
+
135
+ data = data.dup
136
+ data.each{|k, v| event_hash[k] = v.to_s}
137
+
138
+ event_hash
139
+ end
140
+
141
+
142
+ ##
143
+ # Set the emitter namespace.
144
+
145
+ def namespace= str
146
+ @namespace = camelize str
147
+ end
148
+
149
+
150
+ private
151
+
152
+
153
+ def call_format severity, time, progname, message
154
+ FORMAT % [
155
+ HOSTNAME,
156
+ time.strftime(@datetime_format),
157
+ $$,
158
+ severity,
159
+ progname,
160
+ message
161
+ ]
162
+ end
163
+
164
+
165
+ def lwes_emitter ip_address, options={}
166
+ options = {
167
+ :address => ip_address,
168
+ :iface => '0.0.0.0',
169
+ :port => 12345,
170
+ :heartbeat => 1,
171
+ :ttl => 1
172
+ }.merge options
173
+
174
+ LWES::Emitter.new options
175
+ end
176
+
177
+
178
+ def camelize string
179
+ string.gsub(/(_|^)./i){|s| s[-1..-1].upcase}
180
+ end
181
+ end
@@ -0,0 +1,305 @@
1
+ require "rubygems"
2
+ require "test/unit"
3
+ require "tmpdir"
4
+ require "lwes_logger"
5
+ require "flexmock/test_unit"
6
+
7
+ class TestLwesLogger < Test::Unit::TestCase
8
+
9
+ def setup
10
+ @tmpdir = File.join Dir.tmpdir, "lwes_logger_tests_#{$$}"
11
+ FileUtils.mkdir_p @tmpdir
12
+
13
+ @emitter_hash = {
14
+ :address => "127.0.0.1",
15
+ :iface => '0.0.0.0',
16
+ :port => 12345,
17
+ :heartbeat => 1,
18
+ :ttl => 1
19
+ }
20
+
21
+ @mock_emitter = flexmock LWES::Emitter.new(@emitter_hash)
22
+
23
+ @lwes_emitter_class = flexmock LWES::Emitter
24
+ @lwes_emitter_class.should_receive(:new).
25
+ with(@emitter_hash).and_return(@mock_emitter)
26
+
27
+ @logger = LwesLogger.new "127.0.0.1"
28
+
29
+ @time = Time.now
30
+ flexmock(Time).should_receive(:now).and_return(@time)
31
+
32
+ flexmock(UUIDTools::UUID).should_receive(:timestamp_create).
33
+ and_return("uuid_timestamp")
34
+ end
35
+
36
+
37
+ def teardown
38
+ @mock_emitter.reset_emitted if @mock_emitter.respond_to? :reset_emitted
39
+ FileUtils.rm_rf @tmpdir
40
+ end
41
+
42
+
43
+ def test_init
44
+ logger = LwesLogger.new "127.0.0.1"
45
+
46
+ assert LWES::Emitter === logger.emitter
47
+ assert_equal "Full", logger.full_logs_event
48
+ assert_equal false, logger.full_logs_only
49
+ assert_equal "LwesLogger", logger.namespace
50
+ assert_nil logger.instance_variable_get("@logdev")
51
+ end
52
+
53
+
54
+ def test_init_log_device
55
+ log_device = ["#{@tmpdir}/test.log", 10, 10241024]
56
+
57
+ @lwes_emitter_class.should_receive(:new).
58
+ with(@emitter_hash.merge(:log_device => log_device)
59
+ ).and_return(@mock_emitter)
60
+
61
+ logger = LwesLogger.new "127.0.0.1", :log_device => log_device
62
+
63
+ logdev = logger.instance_variable_get("@logdev")
64
+
65
+ assert Logger::LogDevice === logdev
66
+ assert_equal "#{@tmpdir}/test.log", logdev.filename
67
+ assert_equal 10, logdev.instance_variable_get("@shift_age")
68
+ assert_equal 10241024, logdev.instance_variable_get("@shift_size")
69
+ end
70
+
71
+
72
+ def test_init_log_device_io
73
+ logfile = File.open("#{@tmpdir}/test.log", "w+")
74
+
75
+ @lwes_emitter_class.should_receive(:new).
76
+ with(@emitter_hash.merge(:log_device => logfile)
77
+ ).and_return(@mock_emitter)
78
+
79
+ logger = LwesLogger.new "127.0.0.1", :log_device => logfile
80
+ logdev = logger.instance_variable_get("@logdev")
81
+
82
+ assert_equal logfile, logdev.instance_variable_get("@dev")
83
+ logfile.close
84
+ end
85
+
86
+
87
+ def test_init_emitter_options
88
+ @lwes_emitter_class.should_receive(:new).with({
89
+ :address => "0.0.0.0",
90
+ :iface => "244.0.0.1",
91
+ :port => 54321,
92
+ :heartbeat => 5,
93
+ :ttl => 30
94
+ }).at_least.once
95
+
96
+ LwesLogger.new "0.0.0.0",
97
+ :iface => "244.0.0.1",
98
+ :port => 54321,
99
+ :heartbeat => 5,
100
+ :ttl => 30
101
+ end
102
+
103
+
104
+ def test_init_namespace
105
+ @lwes_emitter_class.should_receive(:new).and_return @mock_emitter
106
+
107
+ logger = LwesLogger.new "127.0.0.1", :namespace => "test_namespace"
108
+ assert_equal "TestNamespace", logger.namespace
109
+ end
110
+
111
+
112
+ def test_append
113
+ event_hash = @logger.build_log_event nil, "test log"
114
+
115
+ log_device = StringIO.new("")
116
+
117
+ @lwes_emitter_class.should_receive(:new).
118
+ with(@emitter_hash.merge(:log_device => log_device)).
119
+ and_return(@mock_emitter)
120
+
121
+ add_emit_hooks @mock_emitter
122
+ logger = LwesLogger.new "127.0.0.1", :log_device => log_device
123
+
124
+ logger << "test log"
125
+
126
+ assert_equal 2, @mock_emitter.emitted.length
127
+ assert_equal ["LwesLogger::Full", event_hash], @mock_emitter.emitted[0]
128
+ assert_equal ["LwesLogger::Any", event_hash], @mock_emitter.emitted[1]
129
+
130
+ log_device.rewind
131
+ assert_equal "test log", log_device.read
132
+ end
133
+
134
+
135
+ def test_add
136
+ event_hash = @logger.build_log_event Logger::DEBUG, "test log"
137
+
138
+ log_device = StringIO.new("")
139
+
140
+ @lwes_emitter_class.should_receive(:new).
141
+ with(@emitter_hash.merge(:log_device => log_device)).
142
+ and_return(@mock_emitter)
143
+
144
+ add_emit_hooks @mock_emitter
145
+ logger = LwesLogger.new "127.0.0.1", :log_device => log_device
146
+
147
+ logger.add Logger::DEBUG, "test log"
148
+ args = [logger.send(:format_severity, Logger::DEBUG),
149
+ @time, nil, "test log"]
150
+
151
+ log_line = logger.send :format_message, *args
152
+
153
+ assert_equal 2, @mock_emitter.emitted.length
154
+ assert_equal ["LwesLogger::Full", event_hash], @mock_emitter.emitted[0]
155
+ assert_equal ["LwesLogger::Debug", event_hash], @mock_emitter.emitted[1]
156
+
157
+ log_device.rewind
158
+ assert_equal log_line, log_device.read
159
+ end
160
+
161
+
162
+ def test_namespace=
163
+ @logger.namespace = "test_namespace"
164
+ assert_equal "TestNamespace", @logger.namespace
165
+ end
166
+
167
+
168
+ def test_build_log_event
169
+ hash = @logger.build_log_event Logger::DEBUG,
170
+ "log message",
171
+ "log prog",
172
+ :extra_data => "data"
173
+
174
+ assert_equal({
175
+ :extra_data => "data",
176
+ :message => "log message",
177
+ :progname => "log prog",
178
+ :timestamp => @time.strftime("%b %d %H:%M:%S"),
179
+ :severity => "DEBUG",
180
+ :event_id => "LwesLogger::Debug-uuid_timestamp",
181
+ :hostname => Socket.gethostname,
182
+ :pid => $$.to_s
183
+ }, hash)
184
+ end
185
+
186
+
187
+ def test_build_log_event_overrides
188
+ hash = @logger.build_log_event Logger::DEBUG,
189
+ "log message",
190
+ "log prog",
191
+ :message => "overriden",
192
+ :pid => 0
193
+
194
+ assert_equal "0", hash[:pid]
195
+ assert_equal "overriden", hash[:message]
196
+ end
197
+
198
+
199
+ def test_build_log_event_message
200
+ hash = @logger.build_log_event Logger::DEBUG, "log message", "log prog" do
201
+ "msg from block"
202
+ end
203
+ assert_equal "log message", hash[:message]
204
+
205
+ hash = @logger.build_log_event Logger::DEBUG, nil, "log prog" do
206
+ "msg from block"
207
+ end
208
+ assert_equal "msg from block", hash[:message]
209
+
210
+ hash = @logger.build_log_event Logger::DEBUG, nil, "log prog"
211
+ assert_equal "log prog", hash[:message]
212
+ end
213
+
214
+
215
+ def test_build_log_event_severity
216
+ hash = @logger.build_log_event nil
217
+ assert_equal "ANY", hash[:severity]
218
+ end
219
+
220
+
221
+ def test_build_log_event_progname
222
+ @logger.instance_variable_set("@progname", "inst progname")
223
+ hash = @logger.build_log_event Logger::DEBUG
224
+ assert_equal "inst progname", hash[:progname]
225
+ end
226
+
227
+
228
+ def test_emit_log
229
+ event_hash = @logger.build_log_event Logger::DEBUG, "log msg"
230
+
231
+ @mock_emitter.should_receive(:emit).with "LwesLogger::Full", event_hash
232
+ @mock_emitter.should_receive(:emit).with "LwesLogger::Debug", event_hash
233
+
234
+ @logger.emit_log Logger::DEBUG, "log msg"
235
+ end
236
+
237
+
238
+ def test_emit_log_full_only
239
+ @logger.full_logs_only = true
240
+ event_hash = @logger.build_log_event Logger::DEBUG, "log msg"
241
+
242
+ add_emit_hooks @mock_emitter
243
+ @logger.emit_log Logger::DEBUG, "log msg"
244
+
245
+ assert_equal 1, @mock_emitter.emitted.length
246
+ assert_equal ["LwesLogger::Full", event_hash], @mock_emitter.emitted.first
247
+ end
248
+
249
+
250
+ def test_emit_log_severity_only
251
+ @logger.full_logs_event = false
252
+ event_hash = @logger.build_log_event Logger::DEBUG, "log msg"
253
+
254
+ add_emit_hooks @mock_emitter
255
+ @logger.emit_log Logger::DEBUG, "log msg"
256
+
257
+ assert_equal 1, @mock_emitter.emitted.length
258
+ assert_equal ["LwesLogger::Debug", event_hash], @mock_emitter.emitted.first
259
+ end
260
+
261
+
262
+ def test_call_format
263
+ time = Time.now
264
+ timestamp = time.strftime("%b %d %H:%M:%S")
265
+
266
+ host = Socket.gethostname
267
+ sev = "ERROR"
268
+ prog = "prog"
269
+ msg = "message"
270
+
271
+ results = @logger.send(:call_format, sev, time, prog, msg)
272
+ expected = "#{host} [#{timestamp}##{$$}] #{sev} -- #{prog}: #{msg}\n"
273
+
274
+ assert_equal expected, results
275
+ end
276
+
277
+
278
+ def test_camelize
279
+ assert_equal "TestThing", @logger.send(:camelize, "test_thing")
280
+ assert_equal "Test-thing", @logger.send(:camelize, "test-thing")
281
+ assert_equal "Test-Thing", @logger.send(:camelize, "Test-_thing")
282
+ assert_equal "Test_thing", @logger.send(:camelize, "test__thing")
283
+ assert_equal "TESTTHING", @logger.send(:camelize, "TEST_THING")
284
+ assert_equal "TestThing", @logger.send(:camelize, "TestThing")
285
+ end
286
+
287
+
288
+ private
289
+
290
+ def add_emit_hooks emitter
291
+ emitter.instance_eval do
292
+ def emit *args
293
+ @emitted ||= []
294
+ @emitted << args
295
+ end
296
+ def emitted
297
+ @emitted
298
+ end
299
+ def reset_emitted
300
+ @emitted = []
301
+ end
302
+
303
+ end
304
+ end
305
+ end
metadata ADDED
@@ -0,0 +1,154 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: lwes-logger
3
+ version: !ruby/object:Gem::Version
4
+ hash: 23
5
+ prerelease: false
6
+ segments:
7
+ - 1
8
+ - 0
9
+ - 0
10
+ version: 1.0.0
11
+ platform: ruby
12
+ authors:
13
+ - Jeremie Castagna
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2010-10-08 00:00:00 -07:00
19
+ default_executable:
20
+ dependencies:
21
+ - !ruby/object:Gem::Dependency
22
+ name: lwes
23
+ prerelease: false
24
+ requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ hash: 7
30
+ segments:
31
+ - 0
32
+ - 6
33
+ version: "0.6"
34
+ type: :runtime
35
+ version_requirements: *id001
36
+ - !ruby/object:Gem::Dependency
37
+ name: uuidtools
38
+ prerelease: false
39
+ requirement: &id002 !ruby/object:Gem::Requirement
40
+ none: false
41
+ requirements:
42
+ - - ~>
43
+ - !ruby/object:Gem::Version
44
+ hash: 1
45
+ segments:
46
+ - 2
47
+ - 1
48
+ version: "2.1"
49
+ type: :runtime
50
+ version_requirements: *id002
51
+ - !ruby/object:Gem::Dependency
52
+ name: rubyforge
53
+ prerelease: false
54
+ requirement: &id003 !ruby/object:Gem::Requirement
55
+ none: false
56
+ requirements:
57
+ - - ">="
58
+ - !ruby/object:Gem::Version
59
+ hash: 7
60
+ segments:
61
+ - 2
62
+ - 0
63
+ - 4
64
+ version: 2.0.4
65
+ type: :development
66
+ version_requirements: *id003
67
+ - !ruby/object:Gem::Dependency
68
+ name: flexmock
69
+ prerelease: false
70
+ requirement: &id004 !ruby/object:Gem::Requirement
71
+ none: false
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ hash: 49
76
+ segments:
77
+ - 0
78
+ - 8
79
+ - 7
80
+ version: 0.8.7
81
+ type: :development
82
+ version_requirements: *id004
83
+ - !ruby/object:Gem::Dependency
84
+ name: hoe
85
+ prerelease: false
86
+ requirement: &id005 !ruby/object:Gem::Requirement
87
+ none: false
88
+ requirements:
89
+ - - ">="
90
+ - !ruby/object:Gem::Version
91
+ hash: 19
92
+ segments:
93
+ - 2
94
+ - 6
95
+ - 2
96
+ version: 2.6.2
97
+ type: :development
98
+ version_requirements: *id005
99
+ description: Lwes based ruby logger for real-time logging.
100
+ email:
101
+ - jcastagna@attinteractive.com
102
+ executables: []
103
+
104
+ extensions: []
105
+
106
+ extra_rdoc_files:
107
+ - History.txt
108
+ - Manifest.txt
109
+ - README.txt
110
+ files:
111
+ - .autotest
112
+ - History.txt
113
+ - Manifest.txt
114
+ - README.txt
115
+ - Rakefile
116
+ - lib/lwes_logger.rb
117
+ - test/test_lwes_logger.rb
118
+ has_rdoc: true
119
+ homepage: http://github.com/yaksnrainbows/lwes-logger
120
+ licenses: []
121
+
122
+ post_install_message:
123
+ rdoc_options:
124
+ - --main
125
+ - README.txt
126
+ require_paths:
127
+ - lib
128
+ required_ruby_version: !ruby/object:Gem::Requirement
129
+ none: false
130
+ requirements:
131
+ - - ">="
132
+ - !ruby/object:Gem::Version
133
+ hash: 3
134
+ segments:
135
+ - 0
136
+ version: "0"
137
+ required_rubygems_version: !ruby/object:Gem::Requirement
138
+ none: false
139
+ requirements:
140
+ - - ">="
141
+ - !ruby/object:Gem::Version
142
+ hash: 3
143
+ segments:
144
+ - 0
145
+ version: "0"
146
+ requirements: []
147
+
148
+ rubyforge_project: lwes-logger
149
+ rubygems_version: 1.3.7
150
+ signing_key:
151
+ specification_version: 3
152
+ summary: Lwes based ruby logger for real-time logging.
153
+ test_files:
154
+ - test/test_lwes_logger.rb