The personal finance app for everyone
Logtail
Josh Pigford983729cbdfce
diff --git a/Gemfile b/Gemfileindex 180d47f6..9ab15502 100644--- a/Gemfile+++ b/Gemfile@@ -31,6 +31,7 @@ gem "stackprof"gem "rack-mini-profiler"gem "sentry-ruby"gem "sentry-rails"+gem "logtail-rails"# Active Storagegem "aws-sdk-s3", "~> 1.177.0", require: falsediff --git a/Gemfile.lock b/Gemfile.lockindex 73847b83..3c14233e 100644--- a/Gemfile.lock+++ b/Gemfile.lock@@ -243,6 +243,17 @@ GEMrb-fsevent (~> 0.10, >= 0.10.3)rb-inotify (~> 0.9, >= 0.9.10)logger (1.6.5)+ logtail (0.1.13)+ msgpack (~> 1.0)+ logtail-rack (0.2.5)+ logtail (~> 0.1)+ rack (>= 1.2, < 4.0)+ logtail-rails (0.2.9)+ actionpack (>= 5.0.0)+ activerecord (>= 5.0.0)+ logtail (~> 0.1)+ logtail-rack (~> 0.1)+ railties (>= 5.0.0)loofah (2.24.0)crass (~> 1.0.2)nokogiri (>= 1.12.0)@@ -527,6 +538,7 @@ DEPENDENCIESintercom-railsjwtletter_opener+ logtail-railslucide-rails!mochaoctokitdiff --git a/config/environments/production.rb b/config/environments/production.rbindex 8a5e81cf..fba29091 100644--- a/config/environments/production.rb+++ b/config/environments/production.rb@@ -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 ]