1
0
Fork 0
mirror of https://github.com/maybe-finance/maybe.git synced 2025-08-02 20:15:22 +02:00

Add tagged logging to sync process (#1956)

* Add tagged logging to sync process

* Reduce logging in syncer

* Typo
This commit is contained in:
Zach Gollwitzer 2025-03-05 15:38:31 -05:00 committed by GitHub
parent cffafd23f0
commit 9627a6bf6f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 86 additions and 39 deletions

View file

@ -49,17 +49,18 @@ Rails.application.configure do
config.assume_ssl = ActiveModel::Type::Boolean.new.cast(ENV.fetch("RAILS_ASSUME_SSL", true))
# Log to Logtail if API key is present, otherwise log to STDOUT
config.logger = if ENV["LOGTAIL_API_KEY"].present?
base_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) }
.tap { |logger| logger.formatter = ::Logger::Formatter.new }
end
config.logger = ActiveSupport::TaggedLogging.new(base_logger)
# Prepend all log lines with the following tags.
config.log_tags = [ :request_id ]