logster 2.11.3 → 2.11.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ci.yml +14 -4
- data/CHANGELOG.md +5 -0
- data/assets/javascript/client-app.js +53 -45
- data/assets/javascript/vendor.js +727 -735
- data/client-app/app/models/message-collection.js +2 -1
- data/client-app/package-lock.json +6962 -29519
- data/client-app/package.json +4 -1
- data/client-app/tests/unit/controllers/index-test.js +1 -1
- data/lib/logster/middleware/viewer.rb +12 -12
- data/lib/logster/version.rb +1 -1
- data/test/logster/middleware/test_viewer.rb +14 -8
- metadata +2 -2
data/client-app/package.json
CHANGED
@@ -27,7 +27,7 @@
|
|
27
27
|
"@glimmer/component": "^1.0.0",
|
28
28
|
"babel-eslint": "^10.1.0",
|
29
29
|
"broccoli-asset-rev": "^3.0.0",
|
30
|
-
"ember-auto-import": "^1.
|
30
|
+
"ember-auto-import": "^1.12.2",
|
31
31
|
"ember-cli": "^3.15.0",
|
32
32
|
"ember-cli-app-version": "^3.2.0",
|
33
33
|
"ember-cli-babel": "^7.19.0",
|
@@ -59,5 +59,8 @@
|
|
59
59
|
},
|
60
60
|
"dependencies": {
|
61
61
|
"moment": "~2.29.4"
|
62
|
+
},
|
63
|
+
"overrides": {
|
64
|
+
"testem": "^3.9.0"
|
62
65
|
}
|
63
66
|
}
|
@@ -25,6 +25,6 @@ module('Unit | Controller | index', function (hooks) {
|
|
25
25
|
|
26
26
|
assert.equal(controller.searchTerm, "tomtom", 'search sets search term');
|
27
27
|
assert.equal(ajaxStub.firstCall.args[0], "/messages.json", "get messages");
|
28
|
-
assert.deepEqual(ajaxStub.firstCall.args[1], {"data": {"filter": "5", "search": "tomtom"}}, "with correct terms");
|
28
|
+
assert.deepEqual(ajaxStub.firstCall.args[1], {"data": {"filter": "5", "search": "tomtom"}, "method": "POST"}, "with correct terms");
|
29
29
|
});
|
30
30
|
});
|
@@ -18,7 +18,7 @@ module Logster
|
|
18
18
|
(@store = Logster.store) || raise(ArgumentError.new("store"))
|
19
19
|
|
20
20
|
@assets_path = File.expand_path("../../../../assets", __FILE__)
|
21
|
-
@fileserver = Rack::
|
21
|
+
@fileserver = Rack::Files.new(@assets_path)
|
22
22
|
end
|
23
23
|
|
24
24
|
def call(env)
|
@@ -33,7 +33,7 @@ module Logster
|
|
33
33
|
if resource =~ /\.ico$|\.js$|\.png|\.handlebars$|\.css$|\.woff$|\.ttf$|\.woff2$|\.svg$|\.otf$|\.eot$/
|
34
34
|
serve_file(env, resource)
|
35
35
|
|
36
|
-
elsif resource.start_with?("/messages.json")
|
36
|
+
elsif resource.start_with?("/messages.json") && env[REQUEST_METHOD] == "POST"
|
37
37
|
serve_messages(Rack::Request.new(env))
|
38
38
|
|
39
39
|
elsif resource =~ /\/message\/([0-9a-f]+)$/
|
@@ -102,10 +102,10 @@ module Logster
|
|
102
102
|
end
|
103
103
|
|
104
104
|
if json
|
105
|
-
[200, { "
|
105
|
+
[200, { "content-type" => "application/json; charset=utf-8" }, [message.to_json]]
|
106
106
|
else
|
107
107
|
preload = { "/show/#{key}" => message }
|
108
|
-
[200, { "
|
108
|
+
[200, { "content-type" => "text/html; charset=utf-8" }, [body(preload)]]
|
109
109
|
end
|
110
110
|
|
111
111
|
elsif resource =~ /\/settings(\.json)?$/
|
@@ -128,9 +128,9 @@ module Logster
|
|
128
128
|
grouping = Logster::GroupingPattern.find_all(raw: true).map do |pattern|
|
129
129
|
{ value: pattern }
|
130
130
|
end
|
131
|
-
[200, { "
|
131
|
+
[200, { "content-type" => "application/json; charset=utf-8" }, [JSON.generate(suppression: suppression, grouping: grouping)]]
|
132
132
|
else
|
133
|
-
[200, { "
|
133
|
+
[200, { "content-type" => "text/html; charset=utf-8" }, [body]]
|
134
134
|
end
|
135
135
|
elsif resource =~ /\/patterns\/([a-zA-Z0-9_]+)\.json$/
|
136
136
|
unless Logster.config.enable_custom_patterns_via_ui
|
@@ -161,12 +161,12 @@ module Logster
|
|
161
161
|
Logster.store.remove_ignore_count(pattern)
|
162
162
|
[200, {}, ["OK"]]
|
163
163
|
elsif resource == "/"
|
164
|
-
[200, { "
|
164
|
+
[200, { "content-type" => "text/html; charset=utf-8" }, [body]]
|
165
165
|
elsif resource =~ /\/fetch-env\/([0-9a-f]+)\.json$/
|
166
166
|
key = $1
|
167
167
|
env = Logster.store.get_env(key)
|
168
168
|
if env
|
169
|
-
[200, { "
|
169
|
+
[200, { "content-type" => "application/json; charset=utf-8" }, [JSON.generate(env)]]
|
170
170
|
else
|
171
171
|
not_found
|
172
172
|
end
|
@@ -181,7 +181,7 @@ module Logster
|
|
181
181
|
group.messages_keys.each { |k| Logster.store.solve(k) }
|
182
182
|
[200, {}, []]
|
183
183
|
elsif resource == '/development-preload.json' && ENV["LOGSTER_ENV"] == "development"
|
184
|
-
[200, { "
|
184
|
+
[200, { "content-type" => "application/json; charset=utf-8" }, [JSON.generate(preloaded_data)]]
|
185
185
|
else
|
186
186
|
not_found
|
187
187
|
end
|
@@ -230,7 +230,7 @@ module Logster
|
|
230
230
|
}
|
231
231
|
|
232
232
|
json = JSON.generate(payload)
|
233
|
-
[200, { "
|
233
|
+
[200, { "content-type" => "application/json" }, [json]]
|
234
234
|
end
|
235
235
|
|
236
236
|
def update_patterns(set_name, req)
|
@@ -258,7 +258,7 @@ module Logster
|
|
258
258
|
return method_not_allowed(%w[POST PUT DELETE])
|
259
259
|
end
|
260
260
|
|
261
|
-
[200, { "
|
261
|
+
[200, { "content-type" => "application/json" }, [JSON.generate(pattern: record.to_s)]]
|
262
262
|
rescue => err
|
263
263
|
error_message = err.message
|
264
264
|
|
@@ -293,7 +293,7 @@ module Logster
|
|
293
293
|
if Array === allowed_methods
|
294
294
|
allowed_methods = allowed_methods.join(", ")
|
295
295
|
end
|
296
|
-
[405, { "
|
296
|
+
[405, { "allow" => allowed_methods }, []]
|
297
297
|
end
|
298
298
|
|
299
299
|
def parse_regex(string)
|
data/lib/logster/version.rb
CHANGED
@@ -43,23 +43,29 @@ class TestViewer < Minitest::Test
|
|
43
43
|
end
|
44
44
|
|
45
45
|
def test_search_raceguard_s
|
46
|
-
response = request.
|
46
|
+
response = request.post('/logsie/messages.json?search=searchkey')
|
47
47
|
result = JSON.parse(response.body)
|
48
48
|
assert_equal('searchkey', result['search'])
|
49
49
|
end
|
50
50
|
|
51
51
|
def test_search_raceguard_sr
|
52
|
-
response = request.
|
52
|
+
response = request.post('/logsie/messages.json?search=/regex/®ex_search=true')
|
53
53
|
result = JSON.parse(response.body)
|
54
54
|
assert_equal('/regex/', result['search'])
|
55
55
|
end
|
56
56
|
|
57
57
|
def test_search_raceguard_f
|
58
|
-
response = request.
|
58
|
+
response = request.post("/logsie/messages.json?filter=0_1_2_3_4")
|
59
59
|
result = JSON.parse(response.body)
|
60
60
|
assert_equal([0, 1, 2, 3, 4], result['filter'])
|
61
61
|
end
|
62
62
|
|
63
|
+
def test_search_does_not_respond_to_get_requests
|
64
|
+
response = request.get("/logsie/messages.json?filter=0_1_2_3_4")
|
65
|
+
assert_equal(404, response.status)
|
66
|
+
assert_equal("Not found", response.body)
|
67
|
+
end
|
68
|
+
|
63
69
|
def test_regex_parse
|
64
70
|
assert_equal(/hello/i, viewer.send(:parse_regex, '/hello/i'))
|
65
71
|
end
|
@@ -304,7 +310,7 @@ class TestViewer < Minitest::Test
|
|
304
310
|
).each do |path|
|
305
311
|
response = request.get(path)
|
306
312
|
assert_equal(200, response.status)
|
307
|
-
assert_equal('application/javascript', response.headers['
|
313
|
+
assert_equal('application/javascript', response.headers['content-type'])
|
308
314
|
end
|
309
315
|
end
|
310
316
|
|
@@ -315,7 +321,7 @@ class TestViewer < Minitest::Test
|
|
315
321
|
).each do |path|
|
316
322
|
response = request.get(path)
|
317
323
|
assert_equal(200, response.status)
|
318
|
-
assert_equal('text/css', response.headers['
|
324
|
+
assert_equal('text/css', response.headers['content-type'])
|
319
325
|
end
|
320
326
|
end
|
321
327
|
|
@@ -335,7 +341,7 @@ class TestViewer < Minitest::Test
|
|
335
341
|
Logster.store.clear_all
|
336
342
|
env = { "b" => 1, "c" => 2 }
|
337
343
|
msg = Logster.store.report(Logger::INFO, "test", "something hello", env: env)
|
338
|
-
response = request.
|
344
|
+
response = request.post("/logsie/messages.json")
|
339
345
|
assert_equal(200, response.status)
|
340
346
|
messages = JSON.parse(response.body)["messages"]
|
341
347
|
assert_equal(1, messages.size)
|
@@ -348,7 +354,7 @@ class TestViewer < Minitest::Test
|
|
348
354
|
Logster.store.clear_all
|
349
355
|
env = { "b" => 1, "c" => 2 }
|
350
356
|
msg = Logster.store.report(Logger::INFO, "test", "something hello", env: env)
|
351
|
-
response = request.
|
357
|
+
response = request.post("/logsie/messages.json?search=something")
|
352
358
|
assert_equal(200, response.status)
|
353
359
|
messages = JSON.parse(response.body)["messages"]
|
354
360
|
assert_equal(1, messages.size)
|
@@ -387,7 +393,7 @@ class TestViewer < Minitest::Test
|
|
387
393
|
%i[get head options].each do |m|
|
388
394
|
response = request.public_send(m, "/logsie/solve-group", params: { regex: "/gotta be post/" })
|
389
395
|
assert_equal(405, response.status)
|
390
|
-
assert_equal("POST", response.headers["
|
396
|
+
assert_equal("POST", response.headers["allow"])
|
391
397
|
end
|
392
398
|
latest = Logster.store.latest
|
393
399
|
assert_equal(1, latest.size)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: logster
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.11.
|
4
|
+
version: 2.11.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sam Saffron
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-01-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|