[ENV] Add lograge config

This commit is contained in:
Paul Chavard 2018-08-22 18:10:26 +02:00
parent d2094fbbd1
commit 3e23ba5a4f
3 changed files with 4 additions and 0 deletions

View file

@ -105,4 +105,6 @@ Rails.application.configure do
protocol: :https, protocol: :https,
host: ENV['APP_HOST'] host: ENV['APP_HOST']
} }
config.lograge.enabled = ENV['LOGRAGE_ENABLED'] == 'enabled'
end end

View file

@ -40,6 +40,7 @@ class ActiveJobLogSubscriber < ::ActiveJob::Logging::LogSubscriber
tags.push('exception') if data[:exception] tags.push('exception') if data[:exception]
data[:tags] = tags data[:tags] = tags
data[:type] = 'tps' data[:type] = 'tps'
data[:source] = ENV['SOURCE']
log(data) log(data)
end end

View file

@ -10,6 +10,7 @@ Rails.application.configure do
config.lograge.custom_options = lambda do |event| config.lograge.custom_options = lambda do |event|
{ {
type: 'tps', type: 'tps',
source: ENV['SOURCE'],
tags: ['request', event.payload[:exception] ? 'exception' : nil].compact, tags: ['request', event.payload[:exception] ? 'exception' : nil].compact,
user_id: event.payload[:user_id], user_id: event.payload[:user_id],
user_email: event.payload[:user_email], user_email: event.payload[:user_email],