Compare commits
8 commits
develop
...
feat/add_l
Author | SHA1 | Date | |
---|---|---|---|
|
8de0293ab5 | ||
|
c17cec14d8 | ||
|
a4e1730297 | ||
|
c0857f329e | ||
|
3a04a8af36 | ||
|
1ba2199712 | ||
|
904cfbc316 | ||
|
5e54992987 |
9 changed files with 51 additions and 1 deletions
2
Gemfile
2
Gemfile
|
@ -186,3 +186,5 @@ group :development, :test do
|
|||
gem 'spring'
|
||||
gem 'spring-watcher-listen'
|
||||
end
|
||||
|
||||
gem 'lograge', '~> 0.12.0'
|
||||
|
|
|
@ -398,6 +398,11 @@ GEM
|
|||
llhttp-ffi (0.4.0)
|
||||
ffi-compiler (~> 1.0)
|
||||
rake (~> 13.0)
|
||||
lograge (0.12.0)
|
||||
actionpack (>= 4)
|
||||
activesupport (>= 4)
|
||||
railties (>= 4)
|
||||
request_store (~> 1.0)
|
||||
loofah (2.18.0)
|
||||
crass (~> 1.0.2)
|
||||
nokogiri (>= 1.5.9)
|
||||
|
@ -509,6 +514,8 @@ GEM
|
|||
declarative (< 0.1.0)
|
||||
trailblazer-option (>= 0.1.1, < 0.2.0)
|
||||
uber (< 0.2.0)
|
||||
request_store (1.5.1)
|
||||
rack (>= 1.4)
|
||||
responders (3.0.1)
|
||||
actionpack (>= 5.0)
|
||||
railties (>= 5.0)
|
||||
|
@ -753,6 +760,7 @@ DEPENDENCIES
|
|||
line-bot-api
|
||||
liquid
|
||||
listen
|
||||
lograge (~> 0.12.0)
|
||||
maxminddb
|
||||
mock_redis
|
||||
newrelic_rpm
|
||||
|
|
|
@ -24,4 +24,16 @@ class ApplicationController < ActionController::Base
|
|||
account_user: Current.account_user
|
||||
}
|
||||
end
|
||||
|
||||
def append_info_to_payload(payload)
|
||||
super
|
||||
payload[:level] = case payload[:status]
|
||||
when 200
|
||||
'INFO'
|
||||
when 302
|
||||
'WARN'
|
||||
else
|
||||
'ERROR'
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -76,5 +76,5 @@ Rails.application.configure do
|
|||
Bullet.bullet_logger = true
|
||||
Bullet.rails_logger = true
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
|
|
@ -103,4 +103,5 @@ Rails.application.configure do
|
|||
config.action_mailbox.ingress = ENV.fetch('RAILS_INBOUND_EMAIL_SERVICE', 'relay').to_sym
|
||||
|
||||
Rails.application.routes.default_url_options = { host: ENV['FRONTEND_URL'] }
|
||||
|
||||
end
|
||||
|
|
|
@ -75,4 +75,5 @@ Rails.application.configure do
|
|||
|
||||
# Do not dump schema after migrations.
|
||||
config.active_record.dump_schema_after_migration = false
|
||||
|
||||
end
|
||||
|
|
|
@ -51,4 +51,5 @@ Rails.application.configure do
|
|||
# Raises error for missing translations.
|
||||
# config.action_view.raise_on_missing_translations = true
|
||||
config.log_level = ENV.fetch('LOG_LEVEL', 'debug').to_sym
|
||||
|
||||
end
|
||||
|
|
24
config/initializers/lograge.rb
Normal file
24
config/initializers/lograge.rb
Normal file
|
@ -0,0 +1,24 @@
|
|||
Rails.application.configure do
|
||||
config.lograge.enabled = true
|
||||
config.lograge.keep_original_rails_log = true
|
||||
config.lograge.formatter = Lograge::Formatters::Json.new
|
||||
config.colorize_logging = false
|
||||
config.lograge.custom_payload do |controller|
|
||||
{
|
||||
host: controller.request.host,
|
||||
remote_ip: controller.request.remote_ip,
|
||||
user_id: controller.current_user.try(:id)
|
||||
}
|
||||
end
|
||||
|
||||
config.lograge.custom_options = lambda do |event|
|
||||
{
|
||||
level: event.payload[:level]
|
||||
}
|
||||
end
|
||||
|
||||
config.lograge.ignore_custom = lambda do |event|
|
||||
# ignore update_presence events in log
|
||||
return true if event.payload[:channel_class] == 'RoomChannel'
|
||||
end
|
||||
end
|
|
@ -7,6 +7,7 @@ Sidekiq.configure_client do |config|
|
|||
end
|
||||
|
||||
Sidekiq.configure_server do |config|
|
||||
config.logger.formatter = Sidekiq::Logger::Formatters::JSON.new
|
||||
config.redis = Redis::Config.app
|
||||
config.logger.level = Logger.const_get(ENV.fetch('LOG_LEVEL', 'info').upcase.to_s)
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue