sapience 0.2.13 → 0.2.14
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/sapience/rails/engine.rb +76 -0
- data/lib/sapience/rails/railtie.rb +12 -0
- data/lib/sapience/rails.rb +3 -71
- data/lib/sapience/version.rb +1 -1
- data/sapience.gemspec +1 -3
- data/test_apps/grape/.gitignore +0 -1
- data/test_apps/grape/.rspec +1 -0
- data/test_apps/grape/gemfiles/grape_0.16.2.gemfile.lock +1 -1
- data/test_apps/grape/gemfiles/grape_0.17.0.gemfile.lock +1 -1
- data/test_apps/rails/.gitignore +0 -1
- data/test_apps/rails/.rspec +1 -0
- data/test_apps/rails/Gemfile +1 -0
- metadata +7 -9
- data/bin/console +0 -14
- data/bin/setup +0 -8
- data/bin/tests +0 -27
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: afdfda408cd1c09884406ac7ed3f6d432a8cd082
|
4
|
+
data.tar.gz: 8580864e1662d94e208d3b6ae9fdf45efc675359
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 161fbf7132739364aa04ecaa7a5334a8686e53aa0883ed90c03a291bea9985ab6265697a0b0f294a423762d668e711bf486f042b33e60e64cad18d4201cac911
|
7
|
+
data.tar.gz: 0952e34328a0f224ced2262b1567dc4794d1ef4e12b371749c56718d800d713bfb0d664ad5fd7e0d56f2ca8efa39e2571f7b459e5f2e2e19b3df68cef0124804
|
data/CHANGELOG.md
CHANGED
@@ -0,0 +1,76 @@
|
|
1
|
+
require "sapience"
|
2
|
+
require "sapience/extensions/action_controller/live" if defined?(ActionController::Live)
|
3
|
+
require "sapience/extensions/action_controller/log_subscriber"
|
4
|
+
require "sapience/extensions/action_dispatch/debug_exceptions"
|
5
|
+
require "sapience/extensions/action_view/streaming_template_renderer"
|
6
|
+
require "sapience/extensions/active_record/log_subscriber" if defined?(ActiveRecord)
|
7
|
+
require "sapience/extensions/rails/rack/logger"
|
8
|
+
require "sapience/extensions/rails/rack/logger_info_as_debug"
|
9
|
+
require "sapience/extensions/action_view/log_subscriber"
|
10
|
+
|
11
|
+
module Sapience
|
12
|
+
module Rails
|
13
|
+
class Engine < ::Rails::Engine
|
14
|
+
# Replace Rails logger initializer
|
15
|
+
::Rails::Application::Bootstrap.initializers.delete_if { |i| i.name == :initialize_logger }
|
16
|
+
|
17
|
+
initializer :initialize_logger, group: :all, before: :bootstrap_hook do
|
18
|
+
Sapience.configure
|
19
|
+
|
20
|
+
[:active_record, :action_controller, :action_mailer, :action_view].each do |name|
|
21
|
+
ActiveSupport.on_load(name) { include Sapience::Loggable }
|
22
|
+
end
|
23
|
+
ActiveSupport.on_load(:action_cable) { self.logger = Sapience["ActionCable"] }
|
24
|
+
end
|
25
|
+
|
26
|
+
# Before any initializers run, but after the gems have been loaded
|
27
|
+
config.before_initialize do
|
28
|
+
# Replace the Mongoid Logger
|
29
|
+
Mongoid.logger = Sapience[Mongoid] if defined?(Mongoid)
|
30
|
+
Moped.logger = Sapience[Moped] if defined?(Moped)
|
31
|
+
|
32
|
+
# Replace the Resque Logger
|
33
|
+
Resque.logger = Sapience[Resque] if defined?(Resque) && Resque.respond_to?(:logger)
|
34
|
+
|
35
|
+
# Replace the Sidekiq logger
|
36
|
+
Sidekiq::Logging.logger = Sapience[Sidekiq] if defined?(Sidekiq)
|
37
|
+
|
38
|
+
# Replace the Sequel logger
|
39
|
+
Sequel::Database.logger = Sapience[Sequel] if defined?(Sequel::Database)
|
40
|
+
|
41
|
+
# Replace the Sidetiq logger
|
42
|
+
Sidetiq.logger = Sapience[Sidetiq] if defined?(Sidetiq)
|
43
|
+
|
44
|
+
# Replace the Raven logger
|
45
|
+
# Raven::Configuration.logger = Sapience[Raven::Configuration] if defined?(Raven::Configuration)
|
46
|
+
Raven.send(:include) { Sapience::Loggable }
|
47
|
+
|
48
|
+
# Replace the Sneakers logger
|
49
|
+
Sneakers.configure(log: Sapience[Sneakers]) if defined?(Sneakers)
|
50
|
+
|
51
|
+
# Replace the Bugsnag logger
|
52
|
+
Bugsnag.configure { |config| config.logger = Sapience[Bugsnag] } if defined?(Bugsnag)
|
53
|
+
|
54
|
+
# Set the logger for concurrent-ruby
|
55
|
+
Concurrent.global_logger = Sapience[Concurrent] if defined?(Concurrent)
|
56
|
+
end
|
57
|
+
|
58
|
+
# Before any initializers run, but after the gems have been loaded
|
59
|
+
config.after_initialize do
|
60
|
+
# in the rare case a gem disables logging but still requires a logger (teaspoon gem)
|
61
|
+
::Rails.logger ||= Sapience[::Rails]
|
62
|
+
|
63
|
+
require "sapience/extensions/action_cable/tagged_logger_proxy" if defined?(ActionCable)
|
64
|
+
require "sapience/extensions/active_model_serializers/logging" if defined?(ActiveModelSerializers)
|
65
|
+
require "sapience/extensions/active_job/logging" if defined?(ActiveJob)
|
66
|
+
# Replace the Bugsnag logger
|
67
|
+
Bugsnag.configure { |config| config.logger = Sapience[Bugsnag] } if defined?(Bugsnag)
|
68
|
+
Sapience::Extensions::ActionController::LogSubscriber.attach_to :action_controller
|
69
|
+
# Sapience::Extensions::ActiveSupport::MailerLogSubscriber.attach_to :action_mailer
|
70
|
+
Sapience::Extensions::ActiveRecord::LogSubscriber.attach_to :active_record if defined?(ActiveRecord)
|
71
|
+
Sapience::Extensions::ActionView::LogSubscriber.attach_to :action_view
|
72
|
+
# Sapience::Extensions::ActiveJob::LogSubscriber.attach_to :active_job
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
require "sapience"
|
2
|
+
|
3
|
+
module Sapience
|
4
|
+
module Rails
|
5
|
+
class Railtie < ::Rails::Railtie
|
6
|
+
config.before_configuration do
|
7
|
+
Sapience.add_appender(:stream, io: STDOUT, level: :warn, formatter: :color)
|
8
|
+
::Rails.logger = Sapience[::Rails]
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
data/lib/sapience/rails.rb
CHANGED
@@ -1,75 +1,7 @@
|
|
1
|
-
require "sapience"
|
2
|
-
require "sapience/
|
3
|
-
require "sapience/extensions/action_controller/log_subscriber"
|
4
|
-
require "sapience/extensions/action_dispatch/debug_exceptions"
|
5
|
-
require "sapience/extensions/action_view/streaming_template_renderer"
|
6
|
-
require "sapience/extensions/active_record/log_subscriber" if defined?(ActiveRecord)
|
7
|
-
require "sapience/extensions/rails/rack/logger"
|
8
|
-
require "sapience/extensions/rails/rack/logger_info_as_debug"
|
9
|
-
require "sapience/extensions/action_view/log_subscriber"
|
1
|
+
require "sapience/rails/railtie"
|
2
|
+
require "sapience/rails/engine"
|
10
3
|
|
11
4
|
module Sapience
|
12
|
-
|
13
|
-
|
14
|
-
# Replace Rails logger initializer
|
15
|
-
::Rails::Application::Bootstrap.initializers.delete_if { |i| i.name == :initialize_logger }
|
16
|
-
|
17
|
-
initializer :initialize_logger, group: :all do
|
18
|
-
Sapience.configure
|
19
|
-
::Rails.logger = Sapience[::Rails]
|
20
|
-
[:active_record, :action_controller, :action_mailer, :action_view].each do |name|
|
21
|
-
ActiveSupport.on_load(name) { include Sapience::Loggable }
|
22
|
-
end
|
23
|
-
ActiveSupport.on_load(:action_cable) { self.logger = Sapience["ActionCable"] }
|
24
|
-
end
|
25
|
-
|
26
|
-
# Before any initializers run, but after the gems have been loaded
|
27
|
-
config.before_initialize do
|
28
|
-
# Replace the Mongoid Logger
|
29
|
-
Mongoid.logger = Sapience[Mongoid] if defined?(Mongoid)
|
30
|
-
Moped.logger = Sapience[Moped] if defined?(Moped)
|
31
|
-
|
32
|
-
# Replace the Resque Logger
|
33
|
-
Resque.logger = Sapience[Resque] if defined?(Resque) && Resque.respond_to?(:logger)
|
34
|
-
|
35
|
-
# Replace the Sidekiq logger
|
36
|
-
Sidekiq::Logging.logger = Sapience[Sidekiq] if defined?(Sidekiq)
|
37
|
-
|
38
|
-
# Replace the Sequel logger
|
39
|
-
Sequel::Database.logger = Sapience[Sequel] if defined?(Sequel::Database)
|
40
|
-
|
41
|
-
# Replace the Sidetiq logger
|
42
|
-
Sidetiq.logger = Sapience[Sidetiq] if defined?(Sidetiq)
|
43
|
-
|
44
|
-
# Replace the Raven logger
|
45
|
-
# Raven::Configuration.logger = Sapience[Raven::Configuration] if defined?(Raven::Configuration)
|
46
|
-
Raven.send(:include) { Sapience::Loggable }
|
47
|
-
|
48
|
-
# Replace the Sneakers logger
|
49
|
-
Sneakers.configure(log: Sapience[Sneakers]) if defined?(Sneakers)
|
50
|
-
|
51
|
-
# Replace the Bugsnag logger
|
52
|
-
Bugsnag.configure { |config| config.logger = Sapience[Bugsnag] } if defined?(Bugsnag)
|
53
|
-
|
54
|
-
# Set the logger for concurrent-ruby
|
55
|
-
Concurrent.global_logger = Sapience[Concurrent] if defined?(Concurrent)
|
56
|
-
end
|
57
|
-
|
58
|
-
# Before any initializers run, but after the gems have been loaded
|
59
|
-
config.after_initialize do
|
60
|
-
# in the rare case a gem disables logging but still requires a logger (teaspoon gem)
|
61
|
-
::Rails.logger ||= Sapience[::Rails]
|
62
|
-
|
63
|
-
require "sapience/extensions/action_cable/tagged_logger_proxy" if defined?(ActionCable)
|
64
|
-
require "sapience/extensions/active_model_serializers/logging" if defined?(ActiveModelSerializers)
|
65
|
-
require "sapience/extensions/active_job/logging" if defined?(ActiveJob)
|
66
|
-
# Replace the Bugsnag logger
|
67
|
-
Bugsnag.configure { |config| config.logger = Sapience[Bugsnag] } if defined?(Bugsnag)
|
68
|
-
Sapience::Extensions::ActionController::LogSubscriber.attach_to :action_controller
|
69
|
-
# Sapience::Extensions::ActiveSupport::MailerLogSubscriber.attach_to :action_mailer
|
70
|
-
Sapience::Extensions::ActiveRecord::LogSubscriber.attach_to :active_record if defined?(ActiveRecord)
|
71
|
-
Sapience::Extensions::ActionView::LogSubscriber.attach_to :action_view
|
72
|
-
# Sapience::Extensions::ActiveJob::LogSubscriber.attach_to :active_job
|
73
|
-
end
|
5
|
+
module Rails
|
74
6
|
end
|
75
7
|
end
|
data/lib/sapience/version.rb
CHANGED
data/sapience.gemspec
CHANGED
@@ -22,9 +22,7 @@ Gem::Specification.new do |spec|
|
|
22
22
|
fail "RubyGems 2.0 or newer is required to protect against public gem pushes."
|
23
23
|
end
|
24
24
|
|
25
|
-
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(/^(test|spec|features)\//) }
|
26
|
-
spec.bindir = "bin"
|
27
|
-
spec.executables = spec.files.grep(/^bin\//) { |f| File.basename(f) }
|
25
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(/^(test|spec|features|bin)\//) }
|
28
26
|
spec.require_paths = ["lib"]
|
29
27
|
|
30
28
|
spec.add_dependency "concurrent-ruby", "~> 1.0"
|
data/test_apps/grape/.gitignore
CHANGED
@@ -0,0 +1 @@
|
|
1
|
+
../../.rspec
|
data/test_apps/rails/.gitignore
CHANGED
@@ -0,0 +1 @@
|
|
1
|
+
../../.rspec
|
data/test_apps/rails/Gemfile
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sapience
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.14
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mikael Henriksson
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2016-09-
|
12
|
+
date: 2016-09-22 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: concurrent-ruby
|
@@ -253,10 +253,7 @@ description: Hasslefree autoconfiguration for logging, metrics and exception col
|
|
253
253
|
email:
|
254
254
|
- mika@reevoo.com
|
255
255
|
- alex.malkov@reevoo.com
|
256
|
-
executables:
|
257
|
-
- console
|
258
|
-
- setup
|
259
|
-
- tests
|
256
|
+
executables: []
|
260
257
|
extensions: []
|
261
258
|
extra_rdoc_files: []
|
262
259
|
files:
|
@@ -272,9 +269,6 @@ files:
|
|
272
269
|
- LICENSE.txt
|
273
270
|
- README.md
|
274
271
|
- Rakefile
|
275
|
-
- bin/console
|
276
|
-
- bin/setup
|
277
|
-
- bin/tests
|
278
272
|
- config/default.yml
|
279
273
|
- dev-entrypoint.sh
|
280
274
|
- docker-compose.yml
|
@@ -315,6 +309,8 @@ files:
|
|
315
309
|
- lib/sapience/loggable.rb
|
316
310
|
- lib/sapience/logger.rb
|
317
311
|
- lib/sapience/rails.rb
|
312
|
+
- lib/sapience/rails/engine.rb
|
313
|
+
- lib/sapience/rails/railtie.rb
|
318
314
|
- lib/sapience/sapience.rb
|
319
315
|
- lib/sapience/sneakers.rb
|
320
316
|
- lib/sapience/subscriber.rb
|
@@ -322,6 +318,7 @@ files:
|
|
322
318
|
- lib/tasks/coverage.rake
|
323
319
|
- sapience.gemspec
|
324
320
|
- test_apps/grape/.gitignore
|
321
|
+
- test_apps/grape/.rspec
|
325
322
|
- test_apps/grape/.simplecov
|
326
323
|
- test_apps/grape/Appraisals
|
327
324
|
- test_apps/grape/Gemfile
|
@@ -336,6 +333,7 @@ files:
|
|
336
333
|
- test_apps/grape/spec/lib/ping/api_spec.rb
|
337
334
|
- test_apps/grape/spec/spec_helper.rb
|
338
335
|
- test_apps/rails/.gitignore
|
336
|
+
- test_apps/rails/.rspec
|
339
337
|
- test_apps/rails/.ruby-version
|
340
338
|
- test_apps/rails/.simplecov
|
341
339
|
- test_apps/rails/Gemfile
|
data/bin/console
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
require "bundler/setup"
|
4
|
-
require "sapience"
|
5
|
-
|
6
|
-
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
-
# with your gem easier. You can also use a different console, if you like.
|
8
|
-
|
9
|
-
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
-
# require "pry"
|
11
|
-
# Pry.start
|
12
|
-
|
13
|
-
require "irb"
|
14
|
-
IRB.start
|
data/bin/setup
DELETED
data/bin/tests
DELETED
@@ -1,27 +0,0 @@
|
|
1
|
-
#!/usr/bin/env bash
|
2
|
-
|
3
|
-
current_dir="$(pwd)"
|
4
|
-
function finish {
|
5
|
-
cd $current_dir
|
6
|
-
}
|
7
|
-
trap finish EXIT
|
8
|
-
|
9
|
-
bundle install
|
10
|
-
bundle exec rake
|
11
|
-
[ $? -ne 0 ] && exit $?
|
12
|
-
|
13
|
-
pushd test_apps/grape
|
14
|
-
bundle install
|
15
|
-
bundle appraisal install
|
16
|
-
bundle exec appraisal rake
|
17
|
-
[ $? -ne 0 ] && exit $?
|
18
|
-
popd
|
19
|
-
|
20
|
-
pushd test_apps/rails
|
21
|
-
bundle install
|
22
|
-
bundle exec rake
|
23
|
-
[ $? -ne 0 ] && exit $?
|
24
|
-
popd
|
25
|
-
|
26
|
-
bundle exec rake coverage:merge
|
27
|
-
[ $? -ne 0 ] && exit $?
|