logster 2.18.1 → 2.19.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 458b61f1575d79c07dcf2c72f92dec4061d6edb6ba3d7a56d1b14052f1a73576
4
- data.tar.gz: b650d05bf9da5481331c2c81a3755156cead5b61dfa9148321ef6d0387fa0d7b
3
+ metadata.gz: 8d640ece62f8205d8c641562f84783cb0f66fca777f39aaf55dc52f8ea65c760
4
+ data.tar.gz: 9b1462d284873256db1efeac24ef63a88603597d62e17d9664c52cd6e815e13a
5
5
  SHA512:
6
- metadata.gz: 27f0c1453dd626f4d65d720546d9e704bc03d49803e27ef83863c10c114cf7330746baf25e8a2b0eaafee1c4adccbd07719ce0ee5394be6c69fb2764d04dcf02
7
- data.tar.gz: d43192c5dcdddece5ebbbec99bedd606f696dc7d3bff0ac4e02051ba36c6693008a8837081ea78377e4856ee87babe0b3081e979e03ea4038871e43b12230f8e
6
+ metadata.gz: 2853f439922309af9b48d467d5addaf6724d5ba13942ff82bc14970493e2483cc87dbc9ce380f83314f34dc83b3af8b44e8a23c109eacab7e916b413bbe1551a
7
+ data.tar.gz: ee0e674832871b45699489cae2e91057a33074927053083efd5ae11291a4c76690f62e5c503f8e1e99e19eabda7fbc617cee77e0e983ad3ecf0921f0594288a6
@@ -10,6 +10,8 @@ jobs:
10
10
  backend:
11
11
  runs-on: ubuntu-latest
12
12
 
13
+ name: "Ruby ${{ matrix.ruby }} - Rails ${{ matrix.rails }}"
14
+
13
15
  services:
14
16
  redis:
15
17
  image: redis
@@ -18,7 +20,11 @@ jobs:
18
20
 
19
21
  strategy:
20
22
  matrix:
21
- ruby: ['2.6', '2.7', '3.0', '3.1']
23
+ ruby: ['3.0', '3.1', '3.2', '3.3']
24
+ rails: ['6.1', '7.0', '7.1']
25
+
26
+ env:
27
+ BUNDLE_GEMFILE: ${{ github.workspace }}/gemfiles/rails_${{ matrix.rails }}.gemfile
22
28
 
23
29
  steps:
24
30
  - uses: actions/checkout@v3
@@ -42,9 +48,12 @@ jobs:
42
48
  - name: Build JS app
43
49
  run: bash build_client_app.sh
44
50
 
45
- - name: Tests
51
+ - name: Tests (no Rails)
46
52
  run: bundle exec rake test
47
53
 
54
+ - name: Tests (Railtie)
55
+ run: bundle exec rake test TEST=test/logster/test_railtie.rb
56
+
48
57
  frontend:
49
58
  runs-on: ubuntu-latest
50
59
 
data/CHANGELOG.md CHANGED
@@ -1,6 +1,10 @@
1
1
  # CHANGELOG
2
2
 
3
- - 2024002-19: 2.18.1
3
+ - 2024-02-28: 2.19.0
4
+
5
+ - FIX: Add compatibility with Rails 7.1+
6
+
7
+ - 2024-02-19: 2.18.1
4
8
 
5
9
  - UX: backlink in dark mode has a dark background
6
10
 
data/Gemfile CHANGED
@@ -4,3 +4,7 @@ source "https://rubygems.org"
4
4
 
5
5
  # Specify your gem's dependencies in rack-log-viewer.gemspec
6
6
  gemspec
7
+
8
+ group :development, :test do
9
+ gem "rails", ">= 6.1"
10
+ end
data/Rakefile CHANGED
@@ -4,7 +4,7 @@ require "bundler/gem_tasks"
4
4
  require "rake/testtask"
5
5
 
6
6
  Rake::TestTask.new do |t|
7
- t.pattern = "test/**/test_*.rb"
7
+ t.test_files = FileList["test/**/test_*"].exclude(%r{test/logster/test_railtie\.rb})
8
8
  end
9
9
 
10
10
  task(default: :test)
@@ -12,7 +12,10 @@ task(default: :test)
12
12
  desc "Starts Sinatra and Ember servers"
13
13
  task :client_dev do
14
14
  begin
15
- pid = spawn("cd website && LOGSTER_ENV=development BUNDLE_GEMFILE=Gemfile bundle exec rackup --host 0.0.0.0")
15
+ pid =
16
+ spawn(
17
+ "cd website && LOGSTER_ENV=development BUNDLE_GEMFILE=Gemfile bundle exec rackup --host 0.0.0.0",
18
+ )
16
19
  pid2 = spawn("cd client-app && npx ember s --proxy http://localhost:9292")
17
20
  Process.wait pid
18
21
  Process.wait pid2
@@ -1,6 +1,6 @@
1
1
  var __ember_auto_import__
2
- !function(){var e,r={568:function(e,r,n){var o,t
3
- e.exports=(o=_eai_d,t=_eai_r,window.emberAutoImportDynamic=function(e){return 1===arguments.length?t("_eai_dyn_"+e):t("_eai_dynt_"+e)(Array.prototype.slice.call(arguments,1))},window.emberAutoImportSync=function(e){return t("_eai_sync_"+e)(Array.prototype.slice.call(arguments,1))},o("__v1-addons__early-boot-set__",[],(function(){})),void o("sinon",["__v1-addons__early-boot-set__"],(function(){return n(468)})))},272:function(e,r){window._eai_r=require,window._eai_d=define}},n={}
2
+ !function(){var e,r={530:function(e,r,n){var o,t
3
+ e.exports=(o=_eai_d,t=_eai_r,window.emberAutoImportDynamic=function(e){return 1===arguments.length?t("_eai_dyn_"+e):t("_eai_dynt_"+e)(Array.prototype.slice.call(arguments,1))},window.emberAutoImportSync=function(e){return t("_eai_sync_"+e)(Array.prototype.slice.call(arguments,1))},o("__v1-addons__early-boot-set__",[],(function(){})),void o("sinon",["__v1-addons__early-boot-set__"],(function(){return n(468)})))},477:function(e,r){window._eai_r=require,window._eai_d=define}},n={}
4
4
  function o(e){var t=n[e]
5
5
  if(void 0!==t)return t.exports
6
6
  var i=n[e]={exports:{}}
@@ -17,6 +17,6 @@ var r=function(r,n){var t,i,u=n[0],_=n[1],a=n[2],f=0
17
17
  if(u.some((function(r){return 0!==e[r]}))){for(t in _)o.o(_,t)&&(o.m[t]=_[t])
18
18
  if(a)var c=a(o)}for(r&&r(n);f<u.length;f++)i=u[f],o.o(e,i)&&e[i]&&e[i][0](),e[i]=0
19
19
  return o.O(c)},n=self.webpackChunk_ember_auto_import_=self.webpackChunk_ember_auto_import_||[]
20
- n.forEach(r.bind(null,0)),n.push=r.bind(null,n.push.bind(n))}(),o.O(void 0,[468],(function(){return o(272)}))
21
- var t=o.O(void 0,[468],(function(){return o(568)}))
20
+ n.forEach(r.bind(null,0)),n.push=r.bind(null,n.push.bind(n))}(),o.O(void 0,[468],(function(){return o(477)}))
21
+ var t=o.O(void 0,[468],(function(){return o(530)}))
22
22
  t=o.O(t),__ember_auto_import__=t}()
@@ -1,5 +1,5 @@
1
1
  var __ember_auto_import__
2
- !function(){var r,n={272:function(r,n){window._eai_r=require,window._eai_d=define},576:function(r,n,e){var t,o
2
+ !function(){var r,n={477:function(r,n){window._eai_r=require,window._eai_d=define},887:function(r,n,e){var t,o
3
3
  r.exports=(t=_eai_d,o=_eai_r,window.emberAutoImportDynamic=function(r){return 1===arguments.length?o("_eai_dyn_"+r):o("_eai_dynt_"+r)(Array.prototype.slice.call(arguments,1))},window.emberAutoImportSync=function(r){return o("_eai_sync_"+r)(Array.prototype.slice.call(arguments,1))},t("__v1-addons__early-boot-set__",[],(function(){})),void t("qunit",["__v1-addons__early-boot-set__"],(function(){return e(916)})))}},e={}
4
4
  function t(r){var o=e[r]
5
5
  if(void 0!==o)return o.exports
@@ -17,6 +17,6 @@ var n=function(n,e){var o,i,_=e[0],u=e[1],a=e[2],c=0
17
17
  if(_.some((function(n){return 0!==r[n]}))){for(o in u)t.o(u,o)&&(t.m[o]=u[o])
18
18
  if(a)var f=a(t)}for(n&&n(e);c<_.length;c++)i=_[c],t.o(r,i)&&r[i]&&r[i][0](),r[i]=0
19
19
  return t.O(f)},e=self.webpackChunk_ember_auto_import_=self.webpackChunk_ember_auto_import_||[]
20
- e.forEach(n.bind(null,0)),e.push=n.bind(null,e.push.bind(e))}(),t.O(void 0,[916],(function(){return t(272)}))
21
- var o=t.O(void 0,[916],(function(){return t(576)}))
20
+ e.forEach(n.bind(null,0)),e.push=n.bind(null,e.push.bind(e))}(),t.O(void 0,[916],(function(){return t(477)}))
21
+ var o=t.O(void 0,[916],(function(){return t(887)}))
22
22
  o=t.O(o),__ember_auto_import__=o}()
@@ -1387,4 +1387,4 @@ var r=(0,t.createTemplateFactory)({id:"qqSpoh9d",block:'[[[10,0],[14,0,"settings
1387
1387
  e.default=r})),define("client-app/templates/show",["exports","@ember/template-factory"],(function(e,t){Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0
1388
1388
  var r=(0,t.createTemplateFactory)({id:"d6AYgHoB",block:'[[[8,[39,0],[[24,0,"recent-link"]],[["@route"],["index"]],[["default"],[[[[1,"Recent"]],[]]]]],[1,"\\n\\n"],[10,0],[14,1,"bottom-panel"],[14,0,"full"],[12],[1,"\\n "],[8,[39,1],null,[["@currentMessage","@showTitle","@removeMessage","@solveMessage","@envChangedAction","@currentEnvPosition","@actionsInMenu"],[[30,0,["model"]],"true",[30,0,["removeMessage"]],[30,0,["solveMessage"]],[30,0,["envChanged"]],[30,0,["envPosition"]],false]],null],[1,"\\n"],[13]],[],false,["link-to","message-info"]]',moduleName:"client-app/templates/show.hbs",isStrictMode:!1})
1389
1389
  e.default=r})),define("client-app/config/environment",[],(function(){try{var e="client-app/config/environment",t=document.querySelector('meta[name="'+e+'"]').getAttribute("content"),r={default:JSON.parse(decodeURIComponent(t))}
1390
- return Object.defineProperty(r,"__esModule",{value:!0}),r}catch(n){throw new Error('Could not read config from meta tag with name "'+e+'".')}})),runningTests||require("client-app/app").default.create({name:"client-app",version:"0.0.0+94d51435"})
1390
+ return Object.defineProperty(r,"__esModule",{value:!0}),r}catch(n){throw new Error('Could not read config from meta tag with name "'+e+'".')}})),runningTests||require("client-app/app").default.create({name:"client-app",version:"0.0.0+a023d778"})
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ source "https://rubygems.org"
4
+
5
+ group :test do
6
+ gem "rails", "~> 6.1.0"
7
+ end
8
+
9
+ gemspec path: "../"
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ source "https://rubygems.org"
4
+
5
+ group :test do
6
+ gem "rails", "~> 7.0.0"
7
+ end
8
+
9
+ gemspec path: "../"
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ source "https://rubygems.org"
4
+
5
+ group :test do
6
+ gem "rails", "~> 7.1.0"
7
+ end
8
+
9
+ gemspec path: "../"
@@ -46,9 +46,7 @@ module Logster
46
46
 
47
47
  @allow_grouping = false
48
48
 
49
- if defined?(::Rails) && defined?(::Rails.env) && ::Rails.env.production?
50
- @allow_grouping = true
51
- end
49
+ @allow_grouping = true if defined?(::Rails.env) && ::Rails.env.production?
52
50
  end
53
51
 
54
52
  def subdirectory
@@ -5,32 +5,39 @@ module Logster::Rails
5
5
  class Engine < Rails::Engine
6
6
  end
7
7
 
8
- def self.set_logger(config)
9
- return unless Logster.config.environments.include?(Rails.env.to_sym)
8
+ class << self
9
+ def set_logger(config)
10
+ return unless Logster.config.environments.include?(Rails.env.to_sym)
10
11
 
11
- require "logster/middleware/debug_exceptions"
12
- require "logster/middleware/reporter"
12
+ require "logster/middleware/debug_exceptions"
13
+ require "logster/middleware/reporter"
13
14
 
14
- store = Logster.store ||= Logster::RedisStore.new
15
- store.level = Logger::Severity::WARN if Rails.env.production?
15
+ store = Logster.store ||= Logster::RedisStore.new
16
+ store.level = Logger::Severity::WARN if Rails.env.production?
16
17
 
17
- if Rails.env.development?
18
- require "logster/defer_logger"
19
- logger = Logster::DeferLogger.new(store)
20
- else
21
- logger = Logster::Logger.new(store)
22
- end
18
+ if Rails.env.development?
19
+ require "logster/defer_logger"
20
+ logger = Logster::DeferLogger.new(store)
21
+ else
22
+ logger = Logster::Logger.new(store)
23
+ end
23
24
 
24
- logger.chain(::Rails.logger)
25
- logger.level = ::Rails.logger.level
25
+ logger.level = ::Rails.logger.level
26
26
 
27
- Logster.logger = ::Rails.logger = config.logger = logger
28
- end
27
+ Logster.logger = config.logger = logger
29
28
 
30
- def self.initialize!(app)
31
- return unless Logster.config.environments.include?(Rails.env.to_sym)
29
+ if rails_71?
30
+ ::Rails.logger.broadcast_to(logger)
31
+ else
32
+ logger.chain(::Rails.logger)
33
+ ::Rails.logger = logger
34
+ end
35
+ end
36
+
37
+ def initialize!(app)
38
+ return unless Logster.config.environments.include?(Rails.env.to_sym)
39
+ return unless logster_enabled?
32
40
 
33
- if Logster::Logger === Rails.logger
34
41
  if Logster.config.enable_js_error_reporting
35
42
  app.middleware.insert_before ActionDispatch::ShowExceptions, Logster::Middleware::Reporter
36
43
  end
@@ -52,6 +59,17 @@ module Logster::Rails
52
59
  Logster.config.application_version = git_version.strip if git_version.present?
53
60
  end
54
61
  end
62
+
63
+ private
64
+
65
+ def logster_enabled?
66
+ return ::Rails.logger == Logster.logger unless rails_71?
67
+ ::Rails.logger.broadcasts.include?(Logster.logger)
68
+ end
69
+
70
+ def rails_71?
71
+ ::Rails.version >= "7.1"
72
+ end
55
73
  end
56
74
 
57
75
  class Railtie < ::Rails::Railtie
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Logster
4
- VERSION = "2.18.1"
4
+ VERSION = "2.19.0"
5
5
  end
data/lib/logster.rb CHANGED
@@ -57,4 +57,4 @@ end
57
57
  # check logster/configuration.rb for config options
58
58
  # Logster.config.environments << :staging
59
59
 
60
- require "logster/rails/railtie" if defined?(::Rails) && ::Rails::VERSION::MAJOR.to_i >= 3
60
+ require "logster/rails/railtie" if defined?(::Rails::VERSION) && ::Rails::VERSION::MAJOR.to_i >= 3
data/logster.gemspec CHANGED
@@ -39,4 +39,5 @@ Gem::Specification.new do |spec|
39
39
  spec.add_development_dependency "byebug", "~> 11.1.0"
40
40
  spec.add_development_dependency "rubocop-discourse", "~> 2.4.1"
41
41
  spec.add_development_dependency "syntax_tree"
42
+ spec.add_development_dependency "sqlite3"
42
43
  end
@@ -0,0 +1,31 @@
1
+ # frozen_string_literal: true
2
+ require_relative "boot"
3
+
4
+ require "active_record/railtie"
5
+ require "action_controller/railtie"
6
+
7
+ # Require the gems listed in Gemfile, including any gems
8
+ # you've limited to :test, :development, or :production.
9
+ Bundler.require(*Rails.groups)
10
+
11
+ require "logster"
12
+
13
+ module Dummy
14
+ class Application < Rails::Application
15
+ config.load_defaults Rails::VERSION::STRING.to_f
16
+
17
+ # For compatibility with applications that use this config
18
+ config.action_controller.include_all_helpers = false
19
+
20
+ config.eager_load = false
21
+
22
+ # Configuration for the application, engines, and railties goes here.
23
+ #
24
+ # These settings can be overridden in specific environments using the files
25
+ # in config/environments, which are processed later.
26
+ #
27
+ # config.time_zone = "Central Time (US & Canada)"
28
+ # config.eager_load_paths << Rails.root.join("extras")
29
+ Logster.set_environments([Rails.env.to_sym])
30
+ end
31
+ end
@@ -0,0 +1,6 @@
1
+ # frozen_string_literal: true
2
+ # Set up gems listed in the Gemfile.
3
+ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../../Gemfile", __dir__)
4
+
5
+ require "bundler/setup" if File.exist?(ENV["BUNDLE_GEMFILE"])
6
+ $LOAD_PATH.unshift File.expand_path("../../../lib", __dir__)
@@ -0,0 +1,6 @@
1
+ # frozen_string_literal: true
2
+ # Load the Rails application.
3
+ require_relative "application"
4
+
5
+ # Initialize the Rails application.
6
+ Rails.application.initialize!
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ ENV["RAILS_ENV"] = "test"
4
+
5
+ require "redis"
6
+ require_relative "../dummy/config/environment"
7
+ ActiveRecord::Migrator.migrations_paths = [File.expand_path("dummy/db/migrate", __dir__)]
8
+
9
+ require_relative "../test_helper"
10
+
11
+ class TestRailtie < Minitest::Test
12
+ def test_sets_logger
13
+ refute_nil Logster.logger
14
+
15
+ if Rails.version >= "7.1"
16
+ assert_includes Rails.logger.broadcasts, Logster.logger
17
+ else
18
+ assert_equal Rails.logger, Logster.logger
19
+ end
20
+ end
21
+ end
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.18.1
4
+ version: 2.19.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sam Saffron
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-02-18 00:00:00.000000000 Z
11
+ date: 2024-02-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -150,6 +150,20 @@ dependencies:
150
150
  - - ">="
151
151
  - !ruby/object:Gem::Version
152
152
  version: '0'
153
+ - !ruby/object:Gem::Dependency
154
+ name: sqlite3
155
+ requirement: !ruby/object:Gem::Requirement
156
+ requirements:
157
+ - - ">="
158
+ - !ruby/object:Gem::Version
159
+ version: '0'
160
+ type: :development
161
+ prerelease: false
162
+ version_requirements: !ruby/object:Gem::Requirement
163
+ requirements:
164
+ - - ">="
165
+ - !ruby/object:Gem::Version
166
+ version: '0'
153
167
  description: UI for viewing logs in Rack
154
168
  email:
155
169
  - sam.saffron@gmail.com
@@ -172,8 +186,8 @@ files:
172
186
  - assets/images/icon_144x144.png
173
187
  - assets/images/icon_64x64.png
174
188
  - assets/javascript/.gitkeep
175
- - assets/javascript/chunk.143.260395dfb82bdb155d19.js
176
- - assets/javascript/chunk.178.f01fdd20b1a3e2bdb6af.js
189
+ - assets/javascript/chunk.143.007c0b8cac64ca844382.js
190
+ - assets/javascript/chunk.178.c0a58aba01c86271384b.js
177
191
  - assets/javascript/chunk.468.95dd450003497c781cb3.js
178
192
  - assets/javascript/chunk.916.85a3fc9d873df80f5ea5.js
179
193
  - assets/javascript/client-app.js
@@ -263,6 +277,9 @@ files:
263
277
  - client-app/tests/unit/routes/index-test.js
264
278
  - client-app/tests/unit/routes/show-test.js
265
279
  - client-app/yarn.lock
280
+ - gemfiles/rails_6.1.gemfile
281
+ - gemfiles/rails_7.0.gemfile
282
+ - gemfiles/rails_7.1.gemfile
266
283
  - lib/examples/sidekiq_logster_reporter.rb
267
284
  - lib/logster.rb
268
285
  - lib/logster/base_store.rb
@@ -286,6 +303,9 @@ files:
286
303
  - lib/logster/version.rb
287
304
  - lib/logster/web.rb
288
305
  - logster.gemspec
306
+ - test/dummy/config/application.rb
307
+ - test/dummy/config/boot.rb
308
+ - test/dummy/config/environment.rb
289
309
  - test/examples/test_sidekiq_reporter_example.rb
290
310
  - test/fake_data/Gemfile
291
311
  - test/fake_data/generate.rb
@@ -299,6 +319,7 @@ files:
299
319
  - test/logster/test_logger.rb
300
320
  - test/logster/test_message.rb
301
321
  - test/logster/test_pattern.rb
322
+ - test/logster/test_railtie.rb
302
323
  - test/logster/test_redis_rate_limiter.rb
303
324
  - test/logster/test_redis_store.rb
304
325
  - test/test_helper.rb
@@ -327,6 +348,9 @@ signing_key:
327
348
  specification_version: 4
328
349
  summary: UI for viewing logs in Rack
329
350
  test_files:
351
+ - test/dummy/config/application.rb
352
+ - test/dummy/config/boot.rb
353
+ - test/dummy/config/environment.rb
330
354
  - test/examples/test_sidekiq_reporter_example.rb
331
355
  - test/fake_data/Gemfile
332
356
  - test/fake_data/generate.rb
@@ -340,6 +364,7 @@ test_files:
340
364
  - test/logster/test_logger.rb
341
365
  - test/logster/test_message.rb
342
366
  - test/logster/test_pattern.rb
367
+ - test/logster/test_railtie.rb
343
368
  - test/logster/test_redis_rate_limiter.rb
344
369
  - test/logster/test_redis_store.rb
345
370
  - test/test_helper.rb