feat: add datadog integration and lograge JSON logs formatting

This commit is contained in:
Karol Sójko
2020-07-28 18:26:41 +02:00
parent d7260e8ea7
commit c2ac21be9d
11 changed files with 76 additions and 40 deletions

View File

@@ -0,0 +1,6 @@
if ENV['DATADOG_ENABLED'] == 'true'
Datadog.configure do |c|
# This will activate auto-instrumentation for Rails
c.use :rails
end
end

View File

@@ -0,0 +1,14 @@
Rails.application.configure do
config.lograge.enabled = true
# Generate log in JSON
config.lograge.formatter = Lograge::Formatters::Json.new
config.lograge.custom_options = lambda do |event|
{
:ddsource => ["ruby"],
:time => event.time,
:params => event.payload[:params],
:level => event.payload[:level]
}
end
end