Skip to content

Commit

Permalink
use json_tagged_logging gem
Browse files Browse the repository at this point in the history
  • Loading branch information
suprjinx committed Oct 24, 2024
1 parent 8dbca49 commit 95112f0
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
3 changes: 3 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ gem "tzinfo-data", platforms: %i[ mswin jruby ]
# Reduces boot times through caching; required in config/boot.rb
gem "bootsnap", require: false

# json logging
gem "json_tagged_logger"

# Use Active Storage variants [https://guides.rubyonrails.org/active_storage_overview.html#transforming-images]
# gem "image_processing", "~> 1.2"

Expand Down
4 changes: 4 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,9 @@ GEM
actionview (>= 5.0.0)
activesupport (>= 5.0.0)
json (2.7.2)
json_tagged_logger (0.8.0)
actionpack (>= 5.2)
activesupport (>= 5.2)
jwt (2.9.3)
base64
language_server-protocol (3.17.0.3)
Expand Down Expand Up @@ -290,6 +293,7 @@ DEPENDENCIES
faraday-retry
interactor (~> 3.0)
jbuilder
json_tagged_logger
jwt
ostruct
puma (>= 5.0)
Expand Down
9 changes: 5 additions & 4 deletions config/initializers/logging.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
Rails.application.config.to_prepare do
Rails.logger = ActiveSupport::Logger.new(STDOUT)
Rails.logger.formatter = JsonLogFormatter.new
end
Rails.logger = JsonTaggedLogger::Logger.new(Rails.logger)
Rails.configuration.log_tags = JsonTaggedLogger::LogTagsConfig.generate(
:request_id
)

Check failure on line 5 in config/initializers/logging.rb

View workflow job for this annotation

GitHub Actions / build_test

Layout/TrailingEmptyLines: 1 trailing blank lines detected.

0 comments on commit 95112f0

Please sign in to comment.