logster 2.11.3 → 2.12.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (94) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ci.yml +72 -11
  3. data/.gitignore +2 -0
  4. data/CHANGELOG.md +13 -3
  5. data/README.md +8 -0
  6. data/assets/javascript/.gitkeep +0 -0
  7. data/assets/javascript/chunk.143.2faa04830259ce9aa59a.js +22 -0
  8. data/assets/javascript/chunk.178.ca5ade1d8cbdbfbe6d72.js +22 -0
  9. data/assets/javascript/chunk.468.95dd450003497c781cb3.js +1213 -0
  10. data/assets/javascript/chunk.916.85a3fc9d873df80f5ea5.js +579 -0
  11. data/assets/javascript/client-app.js +1261 -276
  12. data/assets/javascript/vendor.js +4199 -3514
  13. data/assets/stylesheets/.gitkeep +0 -0
  14. data/assets/stylesheets/client-app.css +1 -1
  15. data/assets/stylesheets/vendor.css +1 -1
  16. data/build_client_app.sh +6 -8
  17. data/client-app/.editorconfig +0 -1
  18. data/client-app/.eslintignore +2 -0
  19. data/client-app/.eslintrc +10 -0
  20. data/client-app/.gitignore +1 -1
  21. data/client-app/.prettierignore +21 -0
  22. data/client-app/.prettierrc +1 -0
  23. data/client-app/.template-lintrc.js +10 -0
  24. data/client-app/README.md +4 -5
  25. data/client-app/app/app.js +2 -2
  26. data/client-app/app/components/actions-menu.js +21 -21
  27. data/client-app/app/components/back-trace.js +89 -90
  28. data/client-app/app/components/env-tab.js +41 -29
  29. data/client-app/app/components/message-info.js +78 -75
  30. data/client-app/app/components/message-row.js +20 -17
  31. data/client-app/app/components/page-nav.js +33 -24
  32. data/client-app/app/components/panel-resizer.js +53 -37
  33. data/client-app/app/components/patterns-list.js +101 -84
  34. data/client-app/app/components/tab-contents.js +15 -19
  35. data/client-app/app/components/tabbed-section.js +30 -18
  36. data/client-app/app/components/time-formatter.js +29 -18
  37. data/client-app/app/controllers/index.js +143 -119
  38. data/client-app/app/controllers/show.js +17 -13
  39. data/client-app/app/helpers/or.js +1 -1
  40. data/client-app/app/initializers/app-init.js +23 -34
  41. data/client-app/app/lib/decorators.js +4 -2
  42. data/client-app/app/lib/preload.js +7 -4
  43. data/client-app/app/lib/utilities.js +55 -54
  44. data/client-app/app/models/group.js +20 -15
  45. data/client-app/app/models/message-collection.js +153 -148
  46. data/client-app/app/models/message.js +60 -58
  47. data/client-app/app/models/pattern-item.js +24 -22
  48. data/client-app/app/router.js +2 -2
  49. data/client-app/app/routes/index.js +19 -12
  50. data/client-app/app/routes/settings.js +12 -10
  51. data/client-app/app/routes/show.js +6 -4
  52. data/client-app/app/services/events.js +4 -0
  53. data/client-app/app/styles/app.css +2 -0
  54. data/client-app/app/templates/application.hbs +1 -2
  55. data/client-app/app/templates/components/actions-menu.hbs +23 -8
  56. data/client-app/app/templates/components/back-trace.hbs +10 -3
  57. data/client-app/app/templates/components/env-tab.hbs +9 -7
  58. data/client-app/app/templates/components/message-info.hbs +65 -34
  59. data/client-app/app/templates/components/message-row.hbs +25 -8
  60. data/client-app/app/templates/components/page-nav.hbs +34 -10
  61. data/client-app/app/templates/components/panel-resizer.hbs +3 -3
  62. data/client-app/app/templates/components/patterns-list.hbs +54 -20
  63. data/client-app/app/templates/components/tabbed-section.hbs +12 -4
  64. data/client-app/app/templates/components/time-formatter.hbs +1 -1
  65. data/client-app/app/templates/index.hbs +100 -78
  66. data/client-app/app/templates/settings.hbs +30 -19
  67. data/client-app/app/templates/show.hbs +9 -8
  68. data/client-app/config/ember-cli-update.json +18 -0
  69. data/client-app/config/environment.js +13 -13
  70. data/client-app/config/icons.js +3 -3
  71. data/client-app/config/targets.js +16 -8
  72. data/client-app/ember-cli-build.js +4 -4
  73. data/client-app/package.json +43 -30
  74. data/client-app/testem.js +16 -17
  75. data/client-app/tests/index.html +8 -1
  76. data/client-app/tests/integration/components/back-trace-test.js +32 -26
  77. data/client-app/tests/integration/components/env-tab-test.js +79 -53
  78. data/client-app/tests/integration/components/message-info-test.js +25 -23
  79. data/client-app/tests/integration/components/patterns-list-test.js +14 -11
  80. data/client-app/tests/test-helper.js +8 -4
  81. data/client-app/tests/unit/controllers/index-test.js +32 -16
  82. data/client-app/tests/unit/controllers/show-test.js +5 -5
  83. data/client-app/tests/unit/routes/index-test.js +5 -5
  84. data/client-app/tests/unit/routes/show-test.js +5 -5
  85. data/client-app/yarn.lock +9673 -0
  86. data/lib/logster/middleware/viewer.rb +12 -12
  87. data/lib/logster/version.rb +1 -1
  88. data/logster.gemspec +6 -3
  89. data/test/logster/middleware/test_viewer.rb +14 -8
  90. metadata +15 -6
  91. data/client-app/.eslintrc.js +0 -60
  92. data/client-app/.travis.yml +0 -28
  93. data/client-app/app/components/update-time.js +0 -21
  94. data/client-app/package-lock.json +0 -39196
@@ -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::File.new(@assets_path)
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, { "Content-Type" => "application/json; charset=utf-8" }, [message.to_json]]
105
+ [200, { "content-type" => "application/json; charset=utf-8" }, [message.to_json]]
106
106
  else
107
107
  preload = { "/show/#{key}" => message }
108
- [200, { "Content-Type" => "text/html; charset=utf-8" }, [body(preload)]]
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, { "Content-Type" => "application/json; charset=utf-8" }, [JSON.generate(suppression: suppression, grouping: grouping)]]
131
+ [200, { "content-type" => "application/json; charset=utf-8" }, [JSON.generate(suppression: suppression, grouping: grouping)]]
132
132
  else
133
- [200, { "Content-Type" => "text/html; charset=utf-8" }, [body]]
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, { "Content-Type" => "text/html; charset=utf-8" }, [body]]
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, { "Content-Type" => "application/json; charset=utf-8" }, [JSON.generate(env)]]
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, { "Content-Type" => "application/json; charset=utf-8" }, [JSON.generate(preloaded_data)]]
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, { "Content-Type" => "application/json" }, [json]]
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, { "Content-Type" => "application/json" }, [JSON.generate(pattern: record.to_s)]]
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, { "Allow" => allowed_methods }, []]
296
+ [405, { "allow" => allowed_methods }, []]
297
297
  end
298
298
 
299
299
  def parse_regex(string)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Logster
4
- VERSION = "2.11.3"
4
+ VERSION = "2.12.1"
5
5
  end
data/logster.gemspec CHANGED
@@ -17,9 +17,12 @@ Gem::Specification.new do |spec|
17
17
 
18
18
  spec.required_ruby_version = ">= 2.5.0"
19
19
 
20
- spec.files = `git ls-files -z`.split("\x0").reject do |f|
21
- f.start_with?("website") || f.start_with?("bin")
22
- end
20
+ files =
21
+ `git ls-files -z`.split("\x0").reject { |f| f.start_with?(/website|bin/) }
22
+ files += Dir.glob("assets/javascript/*")
23
+ files += Dir.glob("assets/stylesheets/*")
24
+ spec.files = files
25
+
23
26
  spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
24
27
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
25
28
  spec.require_paths = ["lib"]
@@ -43,23 +43,29 @@ class TestViewer < Minitest::Test
43
43
  end
44
44
 
45
45
  def test_search_raceguard_s
46
- response = request.get('/logsie/messages.json?search=searchkey')
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.get('/logsie/messages.json?search=/regex/&regex_search=true')
52
+ response = request.post('/logsie/messages.json?search=/regex/&regex_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.get("/logsie/messages.json?filter=0_1_2_3_4")
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['Content-Type'])
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['Content-Type'])
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.get("/logsie/messages.json")
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.get("/logsie/messages.json?search=something")
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["Allow"])
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.3
4
+ version: 2.12.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sam Saffron
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-08-25 00:00:00.000000000 Z
11
+ date: 2023-03-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -156,17 +156,25 @@ files:
156
156
  - assets/images/Icon-144_square.png
157
157
  - assets/images/icon_144x144.png
158
158
  - assets/images/icon_64x64.png
159
+ - assets/javascript/.gitkeep
160
+ - assets/javascript/chunk.143.2faa04830259ce9aa59a.js
161
+ - assets/javascript/chunk.178.ca5ade1d8cbdbfbe6d72.js
162
+ - assets/javascript/chunk.468.95dd450003497c781cb3.js
163
+ - assets/javascript/chunk.916.85a3fc9d873df80f5ea5.js
159
164
  - assets/javascript/client-app.js
160
165
  - assets/javascript/vendor.js
166
+ - assets/stylesheets/.gitkeep
161
167
  - assets/stylesheets/client-app.css
162
168
  - assets/stylesheets/vendor.css
163
169
  - build_client_app.sh
164
170
  - client-app/.editorconfig
165
171
  - client-app/.ember-cli
166
172
  - client-app/.eslintignore
167
- - client-app/.eslintrc.js
173
+ - client-app/.eslintrc
168
174
  - client-app/.gitignore
169
- - client-app/.travis.yml
175
+ - client-app/.prettierignore
176
+ - client-app/.prettierrc
177
+ - client-app/.template-lintrc.js
170
178
  - client-app/.watchmanconfig
171
179
  - client-app/README.md
172
180
  - client-app/app/app.js
@@ -181,7 +189,6 @@ files:
181
189
  - client-app/app/components/tab-contents.js
182
190
  - client-app/app/components/tabbed-section.js
183
191
  - client-app/app/components/time-formatter.js
184
- - client-app/app/components/update-time.js
185
192
  - client-app/app/controllers/index.js
186
193
  - client-app/app/controllers/show.js
187
194
  - client-app/app/helpers/logster-url.js
@@ -200,6 +207,7 @@ files:
200
207
  - client-app/app/routes/index.js
201
208
  - client-app/app/routes/settings.js
202
209
  - client-app/app/routes/show.js
210
+ - client-app/app/services/events.js
203
211
  - client-app/app/styles/app.css
204
212
  - client-app/app/templates/application.hbs
205
213
  - client-app/app/templates/components/actions-menu.hbs
@@ -215,12 +223,12 @@ files:
215
223
  - client-app/app/templates/index.hbs
216
224
  - client-app/app/templates/settings.hbs
217
225
  - client-app/app/templates/show.hbs
226
+ - client-app/config/ember-cli-update.json
218
227
  - client-app/config/environment.js
219
228
  - client-app/config/icons.js
220
229
  - client-app/config/optional-features.json
221
230
  - client-app/config/targets.js
222
231
  - client-app/ember-cli-build.js
223
- - client-app/package-lock.json
224
232
  - client-app/package.json
225
233
  - client-app/preload-json-manager.rb
226
234
  - client-app/public/assets/images/icon_144x144.png
@@ -236,6 +244,7 @@ files:
236
244
  - client-app/tests/unit/controllers/show-test.js
237
245
  - client-app/tests/unit/routes/index-test.js
238
246
  - client-app/tests/unit/routes/show-test.js
247
+ - client-app/yarn.lock
239
248
  - lib/examples/sidekiq_logster_reporter.rb
240
249
  - lib/logster.rb
241
250
  - lib/logster/base_store.rb
@@ -1,60 +0,0 @@
1
- module.exports = {
2
- root: true,
3
- parser: 'babel-eslint',
4
- parserOptions: {
5
- ecmaVersion: 2018,
6
- sourceType: 'module',
7
- ecmaFeatures: {
8
- legacyDecorators: true
9
- }
10
- },
11
- plugins: [
12
- 'ember'
13
- ],
14
- globals: {
15
- Em: false,
16
- Ember: false,
17
- moment: false,
18
- _: false
19
- },
20
- extends: [
21
- 'eslint:recommended',
22
- 'plugin:ember/recommended'
23
- ],
24
- env: {
25
- browser: true
26
- },
27
- rules: {
28
- 'ember/no-jquery': 'error'
29
- },
30
- overrides: [
31
- // node files
32
- {
33
- files: [
34
- '.eslintrc.js',
35
- '.template-lintrc.js',
36
- 'ember-cli-build.js',
37
- 'testem.js',
38
- 'blueprints/*/index.js',
39
- 'config/**/*.js',
40
- 'lib/*/index.js',
41
- 'server/**/*.js'
42
- ],
43
- parserOptions: {
44
- sourceType: 'script'
45
- },
46
- env: {
47
- browser: false,
48
- node: true
49
- },
50
- plugins: ['node'],
51
- rules: Object.assign({}, require('eslint-plugin-node').configs.recommended.rules, {
52
- // add your custom rules and overrides for node files here
53
-
54
- // this can be removed once the following is fixed
55
- // https://github.com/mysticatea/eslint-plugin-node/issues/77
56
- 'node/no-unpublished-require': 'off'
57
- })
58
- }
59
- ]
60
- };
@@ -1,28 +0,0 @@
1
- ---
2
- language: node_js
3
- node_js:
4
- - "8"
5
-
6
- sudo: false
7
- dist: trusty
8
-
9
- addons:
10
- chrome: stable
11
-
12
- cache:
13
- directories:
14
- - $HOME/.npm
15
-
16
- env:
17
- global:
18
- # See https://git.io/vdao3 for details.
19
- - JOBS=1
20
-
21
- branches:
22
- only:
23
- - master
24
-
25
- script:
26
- - npm run lint:hbs
27
- - npm run lint:js
28
- - npm test
@@ -1,21 +0,0 @@
1
- import Component from "@ember/component";
2
- import { formatTime } from "client-app/lib/utilities";
3
- import { later } from "@ember/runloop";
4
-
5
- export default Component.extend({
6
- didInsertElement() {
7
- later(this, this.updateTimes, 60000);
8
- },
9
-
10
- updateTimes() {
11
- Array.from(document.querySelectorAll(".auto-update-time")).forEach(node => {
12
- const timestamp = parseInt(node.dataset.timestamp);
13
- if (!timestamp) return;
14
- const formatted = formatTime(timestamp);
15
- if (formatted !== node.innerText) {
16
- node.innerText = formatted;
17
- }
18
- });
19
- later(this, this.updateTimes, 60000);
20
- }
21
- });