eivo-rails 0.1.5 → 0.1.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/config/initializers/logger.rb +33 -0
- data/eivo-rails.gemspec +1 -1
- data/lib/eivo-rails/environments/production.rb +8 -2
- data/lib/eivo-rails/formatter.rb +31 -0
- data/lib/eivo-rails.rb +1 -0
- data/lib/generators/eivo/templates/config/puma.rb +1 -1
- metadata +5 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1f0386c9f9fe278bc745d9e74be0b3480e2e68d6d0161adfd577c2b9891f9056
|
4
|
+
data.tar.gz: 817921eba9e490f829b27e43de6961ff4efc8382c7103f09231b197e414063b4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: efc2b1ae579523dc8097c26822d70f7683a0663d20b81a7c6dae7f9883b73d1b2ea749efaff1ced76997e45f56a39239fe7dce7e62caba46d9dc59ccda855c33
|
7
|
+
data.tar.gz: 7d3588ff9a17f4d5ebbeb5dd56d248cff203e3ed6f1ee2027eee43ad9fd748c26986feca4d3cb694a4a238ed324d9294ea3efc1cb84cf0e67cb5f918d8a14d4f
|
@@ -0,0 +1,33 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
if Rails.env.staging? || Rails.env.production?
|
4
|
+
Rails.application.configure do
|
5
|
+
config.colorize_logging = false
|
6
|
+
|
7
|
+
config.lograge.enabled = true
|
8
|
+
config.lograge.formatter = ::Lograge::Formatters::Raw.new
|
9
|
+
config.lograge.base_controller_class = [
|
10
|
+
'ActionController::API',
|
11
|
+
'ActionController::Base'
|
12
|
+
]
|
13
|
+
|
14
|
+
config.lograge.ignore_actions = ['EIVO::StatusController#index']
|
15
|
+
|
16
|
+
config.lograge.custom_options = ->(event) do
|
17
|
+
result = {
|
18
|
+
params: event.payload[:params].except('controller', 'action', 'format'),
|
19
|
+
request_id: event.payload[:request_id]
|
20
|
+
}
|
21
|
+
|
22
|
+
result[:user_id] = event.payload[:user_id] if event.payload[:user_id]
|
23
|
+
result[:organization_id] = event.payload[:organization_id] if event.payload[:organization_id]
|
24
|
+
|
25
|
+
# https://github.com/roidrage/lograge/pull/307
|
26
|
+
if event.respond_to?(:allocations)
|
27
|
+
result[:allocations] = event.allocations
|
28
|
+
end
|
29
|
+
|
30
|
+
result
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
data/eivo-rails.gemspec
CHANGED
@@ -72,9 +72,15 @@ module EIVO
|
|
72
72
|
# config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new 'app-name')
|
73
73
|
|
74
74
|
if ENV['RAILS_LOG_TO_STDOUT'].present?
|
75
|
-
logger = ActiveSupport::Logger.new(STDOUT)
|
75
|
+
# logger = ActiveSupport::Logger.new(STDOUT)
|
76
|
+
# logger.formatter = config.log_formatter
|
77
|
+
# config.logger = ActiveSupport::TaggedLogging.new(logger)
|
78
|
+
|
79
|
+
config.log_formatter = ::EIVO::Formatter.new
|
80
|
+
logger = ActiveSupport::Logger.new(STDOUT)
|
76
81
|
logger.formatter = config.log_formatter
|
77
|
-
config.
|
82
|
+
config.log_level = :info
|
83
|
+
config.logger = logger
|
78
84
|
end
|
79
85
|
|
80
86
|
# Do not dump schema after migrations.
|
@@ -0,0 +1,31 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'logger'
|
4
|
+
require 'multi_json'
|
5
|
+
|
6
|
+
module EIVO
|
7
|
+
class Formatter < ::Logger::Formatter
|
8
|
+
def call(severity, timestamp, progname, message)
|
9
|
+
json = {
|
10
|
+
pid: $PROCESS_ID,
|
11
|
+
level: severity,
|
12
|
+
timestamp: timestamp.utc.iso8601(3),
|
13
|
+
message: message
|
14
|
+
}
|
15
|
+
|
16
|
+
if progname
|
17
|
+
json[:tag] = progname
|
18
|
+
end
|
19
|
+
|
20
|
+
if defined?(::Sidekiq)
|
21
|
+
context = ::Sidekiq::Context.current
|
22
|
+
|
23
|
+
if !context.empty?
|
24
|
+
json[:context] = context
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
MultiJson.dump(json) << "\n"
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
data/lib/eivo-rails.rb
CHANGED
@@ -9,7 +9,7 @@ environment ENV.fetch('RAILS_ENV') { 'development' }
|
|
9
9
|
if %w[production staging].include?(ENV['RAILS_ENV'])
|
10
10
|
pidfile 'tmp/pids/puma.pid'
|
11
11
|
state_path 'tmp/pids/puma.state'
|
12
|
-
daemonize
|
12
|
+
daemonize ENV.fetch('RAILS_DAEMONIZE') { false }
|
13
13
|
|
14
14
|
if ENV['PORT']
|
15
15
|
bind "tcp://0.0.0.0:#{ENV['PORT']}"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: eivo-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jonathan VUKOVICH-TRIBOUHARET
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-05-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
@@ -142,6 +142,7 @@ files:
|
|
142
142
|
- app/controllers/eivo/concerns/resources.rb
|
143
143
|
- app/controllers/eivo/status_controller.rb
|
144
144
|
- bin/eivo
|
145
|
+
- config/initializers/logger.rb
|
145
146
|
- config/initializers/sentry.rb
|
146
147
|
- config/routes.rb
|
147
148
|
- eivo-rails.gemspec
|
@@ -152,6 +153,7 @@ files:
|
|
152
153
|
- lib/eivo-rails/environments/production.rb
|
153
154
|
- lib/eivo-rails/environments/staging.rb
|
154
155
|
- lib/eivo-rails/environments/test.rb
|
156
|
+
- lib/eivo-rails/formatter.rb
|
155
157
|
- lib/generators/eivo/USAGE
|
156
158
|
- lib/generators/eivo/install_generator.rb
|
157
159
|
- lib/generators/eivo/templates/.env.example
|
@@ -187,7 +189,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
187
189
|
- !ruby/object:Gem::Version
|
188
190
|
version: '0'
|
189
191
|
requirements: []
|
190
|
-
rubygems_version: 3.
|
192
|
+
rubygems_version: 3.1.2
|
191
193
|
signing_key:
|
192
194
|
specification_version: 4
|
193
195
|
summary: EIVO Rails
|