appstats 0.12.5 → 0.13.0
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.
- data/Gemfile.lock +1 -1
- data/db/migrations/20110225192624_add_appstats_log_collector_local_filename.rb +9 -0
- data/db/schema.rb +2 -1
- data/lib/appstats/log_collector.rb +20 -7
- data/lib/appstats/logger.rb +1 -1
- data/lib/appstats/version.rb +1 -1
- data/lib/templates/appstats_config.rb +6 -2
- data/spec/entry_spec.rb +8 -8
- data/spec/log_collector_spec.rb +32 -8
- data/spec/logger_spec.rb +21 -21
- metadata +5 -4
data/Gemfile.lock
CHANGED
data/db/schema.rb
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
#
|
|
11
11
|
# It's strongly recommended to check this file into your version control system.
|
|
12
12
|
|
|
13
|
-
ActiveRecord::Schema.define(:version =>
|
|
13
|
+
ActiveRecord::Schema.define(:version => 20110225192624) do
|
|
14
14
|
|
|
15
15
|
create_table "appstats_actions", :force => true do |t|
|
|
16
16
|
t.string "name"
|
|
@@ -89,6 +89,7 @@ ActiveRecord::Schema.define(:version => 20110223212232) do
|
|
|
89
89
|
t.string "status"
|
|
90
90
|
t.datetime "created_at"
|
|
91
91
|
t.datetime "updated_at"
|
|
92
|
+
t.string "local_filename"
|
|
92
93
|
end
|
|
93
94
|
|
|
94
95
|
add_index "appstats_log_collectors", ["host"], :name => "index_appstats_log_collectors_on_host"
|
|
@@ -5,11 +5,15 @@ module Appstats
|
|
|
5
5
|
class LogCollector < ActiveRecord::Base
|
|
6
6
|
set_table_name "appstats_log_collectors"
|
|
7
7
|
|
|
8
|
-
attr_accessible :host, :filename, :status
|
|
8
|
+
attr_accessible :host, :filename, :status, :local_filename
|
|
9
9
|
has_many :entries, :table_name => 'appstats_entries', :foreign_key => 'appstats_log_collector_id', :order => 'action'
|
|
10
10
|
|
|
11
|
-
def
|
|
12
|
-
|
|
11
|
+
def calculated_local_filename
|
|
12
|
+
if Appstats::LogCollector.downloaded_log_directory.nil?
|
|
13
|
+
File.expand_path("#{File.dirname(__FILE__)}/../../log/appstats_remote_log_#{id}.log")
|
|
14
|
+
else
|
|
15
|
+
File.expand_path("#{Appstats::LogCollector.downloaded_log_directory}/appstats_remote_log_#{id}.log")
|
|
16
|
+
end
|
|
13
17
|
end
|
|
14
18
|
|
|
15
19
|
def processed_filename
|
|
@@ -30,6 +34,14 @@ module Appstats
|
|
|
30
34
|
true
|
|
31
35
|
end
|
|
32
36
|
|
|
37
|
+
def self.downloaded_log_directory=(value)
|
|
38
|
+
@@downloaded_log_directory = value
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
def self.downloaded_log_directory
|
|
42
|
+
@@downloaded_log_directory
|
|
43
|
+
end
|
|
44
|
+
|
|
33
45
|
def self.should_process(last_time)
|
|
34
46
|
return true if last_time.nil?
|
|
35
47
|
Time.now.day > last_time.day
|
|
@@ -91,18 +103,19 @@ module Appstats
|
|
|
91
103
|
password = normalized_logins[host][:password]
|
|
92
104
|
begin
|
|
93
105
|
Net::SCP.start( host, user, :password => password ) do |scp|
|
|
94
|
-
scp.download!( log_collector.filename, log_collector.
|
|
106
|
+
scp.download!( log_collector.filename, log_collector.calculated_local_filename )
|
|
95
107
|
end
|
|
96
108
|
rescue Exception => e
|
|
97
109
|
Appstats.log(:error,"Something bad occurred during Appstats::LogCollector#download_remote_files")
|
|
98
110
|
Appstats.log(:error,e.message)
|
|
99
111
|
end
|
|
100
|
-
if File.exists?(log_collector.
|
|
101
|
-
|
|
112
|
+
if File.exists?(log_collector.calculated_local_filename)
|
|
113
|
+
log_collector.local_filename = log_collector.calculated_local_filename
|
|
102
114
|
log_collector.status = 'downloaded'
|
|
115
|
+
Appstats.log(:info," - #{user}@#{host}:#{log_collector.filename} > #{log_collector.local_filename}")
|
|
103
116
|
count += 1
|
|
104
117
|
else
|
|
105
|
-
Appstats.log(:error, "File #{log_collector.
|
|
118
|
+
Appstats.log(:error, "File #{log_collector.calculated_local_filename} did not download.")
|
|
106
119
|
log_collector.status = 'failed_download'
|
|
107
120
|
end
|
|
108
121
|
log_collector.save
|
data/lib/appstats/logger.rb
CHANGED
data/lib/appstats/version.rb
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
1
|
|
|
2
|
-
|
|
3
|
-
Appstats::Logger.
|
|
2
|
+
# LOGGER CONFIGURATIONS (i.e. what is integrated within all of your apps)
|
|
3
|
+
Appstats::Logger.filename_template = "log/appstats" # usually left as-is
|
|
4
|
+
Appstats::Logger.default_contexts[:app_name] = "YOUR_APP_NAME_HERE" # replace me with your app name
|
|
5
|
+
|
|
6
|
+
# LOG COLLECTOR (i.e. the process / app that downloads all remote logs and processed them)
|
|
7
|
+
Appstats::LogCollector.downloaded_log_directory = "/tmp" # only required for consolidated app
|
data/spec/entry_spec.rb
CHANGED
|
@@ -193,18 +193,18 @@ module Appstats
|
|
|
193
193
|
end
|
|
194
194
|
|
|
195
195
|
it "should understand an entry without contexts" do
|
|
196
|
-
entry = Entry.create_from_logger_string("0.
|
|
196
|
+
entry = Entry.create_from_logger_string("0.13.0 setup[:,=,-n] 2010-09-21 23:15:20 action=address_search")
|
|
197
197
|
Entry.count.should == @before_count + 1
|
|
198
198
|
entry.action.should == "address_search"
|
|
199
|
-
entry.raw_entry.should == "0.
|
|
199
|
+
entry.raw_entry.should == "0.13.0 setup[:,=,-n] 2010-09-21 23:15:20 action=address_search"
|
|
200
200
|
entry.occurred_at.should == Time.parse("2010-09-21 23:15:20")
|
|
201
201
|
end
|
|
202
202
|
|
|
203
203
|
it "should understand contexts" do
|
|
204
|
-
entry = Entry.create_from_logger_string("0.
|
|
204
|
+
entry = Entry.create_from_logger_string("0.13.0 setup[:,=,-n] 2010-09-21 23:15:20 action=address_filter : app_name=Market : server=Live")
|
|
205
205
|
Entry.count.should == @before_count + 1
|
|
206
206
|
entry.action.should == "address_filter"
|
|
207
|
-
entry.raw_entry.should == "0.
|
|
207
|
+
entry.raw_entry.should == "0.13.0 setup[:,=,-n] 2010-09-21 23:15:20 action=address_filter : app_name=Market : server=Live"
|
|
208
208
|
entry.occurred_at.should == Time.parse("2010-09-21 23:15:20")
|
|
209
209
|
entry.contexts.size.should == 2
|
|
210
210
|
entry.contexts[0].context_key = "app_name"
|
|
@@ -214,10 +214,10 @@ module Appstats
|
|
|
214
214
|
end
|
|
215
215
|
|
|
216
216
|
it "should handle 'action' as a context" do
|
|
217
|
-
entry = Entry.create_from_logger_string('0.
|
|
217
|
+
entry = Entry.create_from_logger_string('0.13.0 setup[:,=,-n] 2011-02-24 12:59:57 action=page-view : action=save_ovcen : app_name=cdb')
|
|
218
218
|
Entry.count.should == @before_count + 1
|
|
219
219
|
entry.action.should == "page-view"
|
|
220
|
-
entry.raw_entry.should == "0.
|
|
220
|
+
entry.raw_entry.should == "0.13.0 setup[:,=,-n] 2011-02-24 12:59:57 action=page-view : action=save_ovcen : app_name=cdb"
|
|
221
221
|
entry.occurred_at.should == Time.parse("2011-02-24 12:59:57")
|
|
222
222
|
entry.contexts.size.should == 2
|
|
223
223
|
entry.contexts[0].context_key = "action"
|
|
@@ -228,10 +228,10 @@ module Appstats
|
|
|
228
228
|
end
|
|
229
229
|
|
|
230
230
|
it "should handle multiple of the same 'context'" do
|
|
231
|
-
entry = Entry.create_from_logger_string('0.
|
|
231
|
+
entry = Entry.create_from_logger_string('0.13.0 setup[:,=,-n] 2011-02-24 12:59:57 action=page-view : app_name=market : app_name=cdb')
|
|
232
232
|
Entry.count.should == @before_count + 1
|
|
233
233
|
entry.action.should == "page-view"
|
|
234
|
-
entry.raw_entry.should == "0.
|
|
234
|
+
entry.raw_entry.should == "0.13.0 setup[:,=,-n] 2011-02-24 12:59:57 action=page-view : app_name=market : app_name=cdb"
|
|
235
235
|
entry.occurred_at.should == Time.parse("2011-02-24 12:59:57")
|
|
236
236
|
entry.contexts.size.should == 2
|
|
237
237
|
entry.contexts[0].context_key = "app_name"
|
data/spec/log_collector_spec.rb
CHANGED
|
@@ -12,12 +12,14 @@ module Appstats
|
|
|
12
12
|
@login = { :host => "myhost.localnet", :user => "deployer", :password => "pass" }
|
|
13
13
|
@login2 = { :host => "yourhost.localnet", :user => "deployer", :password => "ssap" }
|
|
14
14
|
@logins = [@login2, @login]
|
|
15
|
+
Appstats::LogCollector.downloaded_log_directory = nil
|
|
15
16
|
end
|
|
16
17
|
|
|
17
18
|
after(:each) do
|
|
18
19
|
LogCollector.all.each do |log_collector|
|
|
19
|
-
File.delete(log_collector.local_filename) if File.exists?(log_collector.local_filename)
|
|
20
|
+
File.delete(log_collector.local_filename) if !log_collector.local_filename.nil? && File.exists?(log_collector.local_filename)
|
|
20
21
|
end
|
|
22
|
+
Appstats::LogCollector.downloaded_log_directory = nil
|
|
21
23
|
end
|
|
22
24
|
|
|
23
25
|
def simple_path(local_path_to_filename)
|
|
@@ -37,14 +39,19 @@ module Appstats
|
|
|
37
39
|
it "should set status to unprocessed" do
|
|
38
40
|
@log_collector.status.should == nil
|
|
39
41
|
end
|
|
42
|
+
|
|
43
|
+
it "should set local_filename to nil" do
|
|
44
|
+
@log_collector.local_filename.should == nil
|
|
45
|
+
end
|
|
40
46
|
|
|
41
47
|
it "should set on constructor" do
|
|
42
|
-
log_collector = Appstats::LogCollector.new(:host => 'a', :filename => 'b', :status => 'c')
|
|
48
|
+
log_collector = Appstats::LogCollector.new(:host => 'a', :filename => 'b', :status => 'c', :local_filename => 'd')
|
|
43
49
|
log_collector.host.should == 'a'
|
|
44
50
|
log_collector.filename.should == 'b'
|
|
45
51
|
log_collector.status.should == 'c'
|
|
52
|
+
log_collector.local_filename.should == 'd'
|
|
46
53
|
end
|
|
47
|
-
|
|
54
|
+
|
|
48
55
|
end
|
|
49
56
|
|
|
50
57
|
|
|
@@ -182,11 +189,21 @@ module Appstats
|
|
|
182
189
|
|
|
183
190
|
end
|
|
184
191
|
|
|
185
|
-
describe "#
|
|
192
|
+
describe "#calculated_local_filename" do
|
|
193
|
+
|
|
194
|
+
before(:each) do
|
|
195
|
+
Appstats::LogCollector.downloaded_log_directory = nil
|
|
196
|
+
end
|
|
186
197
|
|
|
187
198
|
it "should return a standardized name with the log collector id" do
|
|
188
199
|
log = LogCollector.create
|
|
189
|
-
log.
|
|
200
|
+
log.calculated_local_filename.should == simple_path("../log/appstats_remote_log_#{log.id}.log")
|
|
201
|
+
end
|
|
202
|
+
|
|
203
|
+
it "should use the downloaded_log_directory if set" do
|
|
204
|
+
Appstats::LogCollector.downloaded_log_directory = "/a/b/c"
|
|
205
|
+
log = LogCollector.create
|
|
206
|
+
log.calculated_local_filename.should == "/a/b/c/appstats_remote_log_#{log.id}.log"
|
|
190
207
|
end
|
|
191
208
|
|
|
192
209
|
end
|
|
@@ -241,8 +258,8 @@ module Appstats
|
|
|
241
258
|
log1 = LogCollector.find_by_filename("/my/path/log/app1")
|
|
242
259
|
log2 = LogCollector.find_by_filename("/my/path/log/app2")
|
|
243
260
|
|
|
244
|
-
File.open(log1.
|
|
245
|
-
File.open(log2.
|
|
261
|
+
File.open(log1.calculated_local_filename, 'w') {|f| f.write("testfile - delete") }
|
|
262
|
+
File.open(log2.calculated_local_filename, 'w') {|f| f.write("testfile - delete") }
|
|
246
263
|
|
|
247
264
|
|
|
248
265
|
scp = mock(Net::SCP)
|
|
@@ -255,12 +272,16 @@ module Appstats
|
|
|
255
272
|
LogCollector.download_remote_files(@logins).should == 2
|
|
256
273
|
|
|
257
274
|
log1.reload and log2.reload
|
|
275
|
+
|
|
276
|
+
log1.local_filename.should == log1.calculated_local_filename
|
|
277
|
+
log2.local_filename.should == log2.calculated_local_filename
|
|
278
|
+
|
|
258
279
|
log1.status.should == "downloaded"
|
|
259
280
|
log2.status.should == "downloaded"
|
|
260
281
|
|
|
261
282
|
LogCollector.load_remote_files(@login,"/my/path/log",["app3"]).should == 1
|
|
262
283
|
log3 = LogCollector.find_by_filename("/my/path/log/app3")
|
|
263
|
-
File.open(log3.
|
|
284
|
+
File.open(log3.calculated_local_filename, 'w') {|f| f.write("testfile - delete") }
|
|
264
285
|
|
|
265
286
|
localfile = simple_path("../log/appstats_remote_log_#{log3.id}.log")
|
|
266
287
|
scp.should_receive(:download!).with("/my/path/log/app3",localfile)
|
|
@@ -291,6 +312,8 @@ module Appstats
|
|
|
291
312
|
LogCollector.load_remote_files(@login,"/my/path/log",["appstats1"]).should == 1
|
|
292
313
|
log3 = LogCollector.find_by_filename("/my/path/log/appstats1")
|
|
293
314
|
log3.status = "downloaded" and log3.save.should == true
|
|
315
|
+
log3.local_filename = log3.calculated_local_filename
|
|
316
|
+
log3.save
|
|
294
317
|
File.open(log3.local_filename, 'w') {|f| f.write(Appstats::Logger.entry_to_s("test_action1") + "\n" + Appstats::Logger.entry_to_s("test_action2")) }
|
|
295
318
|
|
|
296
319
|
Appstats.should_receive(:log).with(:info,"About to process 1 file(s).")
|
|
@@ -310,6 +333,7 @@ module Appstats
|
|
|
310
333
|
LogCollector.load_remote_files(@login,"/my/path/log",["appstats1"]).should == 1
|
|
311
334
|
log3 = LogCollector.find_by_filename("/my/path/log/appstats1")
|
|
312
335
|
log3.status = "downloaded" and log3.save.should == true
|
|
336
|
+
log3.local_filename = log3.calculated_local_filename
|
|
313
337
|
File.open(log3.local_filename, 'w') {|f| f.write(Appstats::Logger.entry_to_s("test_action1") + "\n" + Appstats::Logger.entry_to_s("test_action2")) }
|
|
314
338
|
|
|
315
339
|
File.stub!(:open).and_raise("bad error")
|
data/spec/logger_spec.rb
CHANGED
|
@@ -115,7 +115,7 @@ module Appstats
|
|
|
115
115
|
|
|
116
116
|
it "should accept numbers" do
|
|
117
117
|
Appstats::Logger.entry(5, :blah => 6)
|
|
118
|
-
Appstats::Logger.raw_read.should == ["0.
|
|
118
|
+
Appstats::Logger.raw_read.should == ["0.13.0 setup[:,=,-n] 2010-09-21 23:15:20 action=5 : blah=6"]
|
|
119
119
|
end
|
|
120
120
|
|
|
121
121
|
end
|
|
@@ -124,7 +124,7 @@ module Appstats
|
|
|
124
124
|
|
|
125
125
|
it "should look similar to regular entry" do
|
|
126
126
|
Appstats::Logger.exception_entry(RuntimeError.new("blah"),:on => "login")
|
|
127
|
-
Appstats::Logger.raw_read.should == ["0.
|
|
127
|
+
Appstats::Logger.raw_read.should == ["0.13.0 setup[:,=,-n] 2010-09-21 23:15:20 action=appstats-exception : error=blah : on=login"]
|
|
128
128
|
end
|
|
129
129
|
|
|
130
130
|
end
|
|
@@ -141,47 +141,47 @@ module Appstats
|
|
|
141
141
|
|
|
142
142
|
it "should handle a statistics entry" do
|
|
143
143
|
expected = { :action => "address_search", :timestamp => "2010-09-21 23:15:20" }
|
|
144
|
-
actual = Appstats::Logger.entry_to_hash("0.
|
|
144
|
+
actual = Appstats::Logger.entry_to_hash("0.13.0 setup[:,=,-n] 2010-09-21 23:15:20 action=address_search")
|
|
145
145
|
actual.should == expected
|
|
146
146
|
end
|
|
147
147
|
|
|
148
148
|
it "should handle contexts" do
|
|
149
149
|
expected = { :action => "address_filter", :timestamp => "2010-09-21 23:15:20", :server => "Live", :app_name => 'Market' }
|
|
150
|
-
actual = Appstats::Logger.entry_to_hash("0.
|
|
150
|
+
actual = Appstats::Logger.entry_to_hash("0.13.0 setup[:,=,-n] 2010-09-21 23:15:20 action=address_filter : app_name=Market : server=Live")
|
|
151
151
|
actual.should == expected
|
|
152
152
|
end
|
|
153
153
|
|
|
154
154
|
it "should handle multiple actions" do
|
|
155
155
|
expected = { :action => ["address_filter", "blah"], :timestamp => "2010-09-21 23:15:20", :server => "Live", :app_name => 'Market' }
|
|
156
|
-
actual = Appstats::Logger.entry_to_hash("0.
|
|
156
|
+
actual = Appstats::Logger.entry_to_hash("0.13.0 setup[:,=,-n] 2010-09-21 23:15:20 action=address_filter : action=blah : app_name=Market : server=Live")
|
|
157
157
|
actual.should == expected
|
|
158
158
|
end
|
|
159
159
|
|
|
160
160
|
it "should handle multiple of same context" do
|
|
161
161
|
expected = { :action => "address_filter", :timestamp => "2010-09-21 23:15:20", :server => "Live", :app_name => ['Sin','Market'] }
|
|
162
|
-
actual = Appstats::Logger.entry_to_hash("0.
|
|
162
|
+
actual = Appstats::Logger.entry_to_hash("0.13.0 setup[:,=,-n] 2010-09-21 23:15:20 action=address_filter : app_name=Sin : app_name=Market : server=Live")
|
|
163
163
|
actual.should == expected
|
|
164
164
|
end
|
|
165
165
|
|
|
166
166
|
it "should handle no actions" do
|
|
167
167
|
expected = { :action => "UNKNOWN_ACTION", :timestamp => "2010-09-21 23:15:20", :server => "Live", :app_name => 'Market' }
|
|
168
|
-
actual = Appstats::Logger.entry_to_hash("0.
|
|
168
|
+
actual = Appstats::Logger.entry_to_hash("0.13.0 setup[:,=,-n] 2010-09-21 23:15:20 app_name=Market : server=Live")
|
|
169
169
|
actual.should == expected
|
|
170
170
|
end
|
|
171
171
|
|
|
172
172
|
it "should handle actions with the delimiter (and change the delimiter)" do
|
|
173
173
|
expected = { :action => "address:=search-n", :timestamp => "2010-09-21 23:15:20" }
|
|
174
|
-
actual = Appstats::Logger.entry_to_hash("0.
|
|
174
|
+
actual = Appstats::Logger.entry_to_hash("0.13.0 setup[::,==,--n] 2010-09-21 23:15:20 action==address:=search-n")
|
|
175
175
|
actual.should == expected
|
|
176
176
|
|
|
177
177
|
expected = { :action => "address::search==--n", :timestamp => "2010-09-21 23:15:20" }
|
|
178
|
-
actual = Appstats::Logger.entry_to_hash("0.
|
|
178
|
+
actual = Appstats::Logger.entry_to_hash("0.13.0 setup[:::,===,---n] 2010-09-21 23:15:20 action===address::search==--n")
|
|
179
179
|
actual.should == expected
|
|
180
180
|
end
|
|
181
181
|
|
|
182
182
|
it "should handle contexts with the delimiter (and change the delimiter)" do
|
|
183
183
|
expected = { :action => "address", :timestamp => "2010-09-21 23:15:20", :server => "market:eval=-n" }
|
|
184
|
-
actual = Appstats::Logger.entry_to_hash("0.
|
|
184
|
+
actual = Appstats::Logger.entry_to_hash("0.13.0 setup[::,==,--n] 2010-09-21 23:15:20 action==address :: server==market:eval=-n")
|
|
185
185
|
actual.should == expected
|
|
186
186
|
end
|
|
187
187
|
|
|
@@ -190,66 +190,66 @@ module Appstats
|
|
|
190
190
|
describe "#entry_to_s" do
|
|
191
191
|
|
|
192
192
|
it "should handle a statistics entry" do
|
|
193
|
-
expected = "0.
|
|
193
|
+
expected = "0.13.0 setup[:,=,-n] 2010-09-21 23:15:20 action=address_search"
|
|
194
194
|
actual = Appstats::Logger.entry_to_s("address_search")
|
|
195
195
|
actual.should == expected
|
|
196
196
|
end
|
|
197
197
|
|
|
198
198
|
it "should handle numbers" do
|
|
199
|
-
expected = "0.
|
|
199
|
+
expected = "0.13.0 setup[:,=,-n] 2010-09-21 23:15:20 action=1 : note=2.2"
|
|
200
200
|
actual = Appstats::Logger.entry_to_s(1,:note => 2.2)
|
|
201
201
|
actual.should == expected
|
|
202
202
|
end
|
|
203
203
|
|
|
204
204
|
it "should handle default contexts" do
|
|
205
205
|
Appstats::Logger.default_contexts[:app_name] = "market"
|
|
206
|
-
expected = "0.
|
|
206
|
+
expected = "0.13.0 setup[:,=,-n] 2010-09-21 23:15:20 action=address_search : app_name=market"
|
|
207
207
|
actual = Appstats::Logger.entry_to_s("address_search")
|
|
208
208
|
actual.should == expected
|
|
209
209
|
end
|
|
210
210
|
|
|
211
211
|
it "should handle contexts (and sort them by symbol)" do
|
|
212
|
-
expected = "0.
|
|
212
|
+
expected = "0.13.0 setup[:,=,-n] 2010-09-21 23:15:20 action=address_filter : app_name=Market : server=Live"
|
|
213
213
|
actual = Appstats::Logger.entry_to_s("address_filter", { :server => "Live", :app_name => 'Market' })
|
|
214
214
|
actual.should == expected
|
|
215
215
|
end
|
|
216
216
|
|
|
217
217
|
it "should handle actions with the delimiter (and change the delimiter)" do
|
|
218
|
-
expected = "0.
|
|
218
|
+
expected = "0.13.0 setup[::,==,--n] 2010-09-21 23:15:20 action==address:=search-n"
|
|
219
219
|
actual = Appstats::Logger.entry_to_s("address:=search-n")
|
|
220
220
|
actual.should == expected
|
|
221
221
|
|
|
222
|
-
expected = "0.
|
|
222
|
+
expected = "0.13.0 setup[:::,===,---n] 2010-09-21 23:15:20 action===address::search==--n"
|
|
223
223
|
actual = Appstats::Logger.entry_to_s("address::search==--n")
|
|
224
224
|
actual.should == expected
|
|
225
225
|
end
|
|
226
226
|
|
|
227
227
|
it "should handle contexts with the delimiter (and change the delimiter)" do
|
|
228
|
-
expected = "0.
|
|
228
|
+
expected = "0.13.0 setup[::,==,--n] 2010-09-21 23:15:20 action==address :: server==market:eval=-n"
|
|
229
229
|
actual = Appstats::Logger.entry_to_s("address", :server => 'market:eval=-n')
|
|
230
230
|
actual.should == expected
|
|
231
231
|
end
|
|
232
232
|
|
|
233
233
|
it "should ignore spaces" do
|
|
234
|
-
expected = "0.
|
|
234
|
+
expected = "0.13.0 setup[:,=,-n] 2010-09-21 23:15:20 action=address search"
|
|
235
235
|
actual = Appstats::Logger.entry_to_s("address search")
|
|
236
236
|
actual.should == expected
|
|
237
237
|
end
|
|
238
238
|
|
|
239
239
|
it "should convert newlines in action" do
|
|
240
|
-
expected = "0.
|
|
240
|
+
expected = "0.13.0 setup[:,=,-n] 2010-09-21 23:15:20 action=address_-nsearch"
|
|
241
241
|
actual = Appstats::Logger.entry_to_s("address_\nsearch")
|
|
242
242
|
actual.should == expected
|
|
243
243
|
end
|
|
244
244
|
|
|
245
245
|
it "should convert newlines in context" do
|
|
246
|
-
expected = "0.
|
|
246
|
+
expected = "0.13.0 setup[:,=,-n] 2010-09-21 23:15:20 action=address_search : blah=some-nlong-nstatement"
|
|
247
247
|
actual = Appstats::Logger.entry_to_s("address_search",:blah => "some\nlong\nstatement")
|
|
248
248
|
actual.should == expected
|
|
249
249
|
end
|
|
250
250
|
|
|
251
251
|
it "should convert newlines based on the delimiter" do
|
|
252
|
-
expected = "0.
|
|
252
|
+
expected = "0.13.0 setup[::,==,--n] 2010-09-21 23:15:20 action==address:=--nsearch-n"
|
|
253
253
|
actual = Appstats::Logger.entry_to_s("address:=\nsearch-n")
|
|
254
254
|
actual.should == expected
|
|
255
255
|
end
|
metadata
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: appstats
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
hash:
|
|
4
|
+
hash: 43
|
|
5
5
|
prerelease: false
|
|
6
6
|
segments:
|
|
7
7
|
- 0
|
|
8
|
-
-
|
|
9
|
-
-
|
|
10
|
-
version: 0.
|
|
8
|
+
- 13
|
|
9
|
+
- 0
|
|
10
|
+
version: 0.13.0
|
|
11
11
|
platform: ruby
|
|
12
12
|
authors:
|
|
13
13
|
- Andrew Forward
|
|
@@ -158,6 +158,7 @@ files:
|
|
|
158
158
|
- db/migrations/20110217234136_add_appstats_results_contexts.rb
|
|
159
159
|
- db/migrations/20110222215437_create_appstats_jobs.rb
|
|
160
160
|
- db/migrations/20110223212232_add_appstats_entries_week_and_quarter.rb
|
|
161
|
+
- db/migrations/20110225192624_add_appstats_log_collector_local_filename.rb
|
|
161
162
|
- db/schema.rb
|
|
162
163
|
- lib/appstats.rb
|
|
163
164
|
- lib/appstats/action.rb
|