1
0
Fork 0
mirror of https://github.com/maybe-finance/maybe.git synced 2025-08-02 20:15:22 +02:00
This commit is contained in:
Josh Pigford 2025-02-03 19:49:41 -06:00
parent 89027f1fbf
commit 983729cbdf
3 changed files with 24 additions and 4 deletions

View file

@ -48,10 +48,17 @@ Rails.application.configure do
# Can be used together with config.force_ssl for Strict-Transport-Security and secure cookies.
config.assume_ssl = ActiveModel::Type::Boolean.new.cast(ENV.fetch("RAILS_ASSUME_SSL", true))
# Log to STDOUT by default
config.logger = ActiveSupport::Logger.new(STDOUT)
.tap { |logger| logger.formatter = ::Logger::Formatter.new }
.then { |logger| ActiveSupport::TaggedLogging.new(logger) }
# Log to Logtail if API key is present, otherwise log to STDOUT
config.logger = if ENV["LOGTAIL_API_KEY"].present?
Logtail::Logger.create_default_logger(
ENV["LOGTAIL_API_KEY"],
telemetry_host: "in.logs.betterstack.com"
)
else
ActiveSupport::Logger.new(STDOUT)
.tap { |logger| logger.formatter = ::Logger::Formatter.new }
.then { |logger| ActiveSupport::TaggedLogging.new(logger) }
end
# Prepend all log lines with the following tags.
config.log_tags = [ :request_id ]