Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,9 @@ gem 'tzinfo-data', platforms: %i[windows jruby]

gem 'rack-cors'

# Replace default logger with semantic logging
gem 'rails_semantic_logger'

Comment thread
JPrevost marked this conversation as resolved.
# Use Redis adapter to run Action Cable in production
# gem "redis", ">= 4.0.1"

Expand Down Expand Up @@ -108,6 +111,9 @@ group :development, :test do
end

group :development do
# We apply robust formatting to log messages in development
gem 'amazing_print'

# Add annotations to model, test, fixtures when run
gem 'annotaterb'

Expand Down
9 changes: 9 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ GEM
activerecord (>= 6.0, < 9.0)
kaminari (~> 1.2.2)
aes_key_wrap (1.1.0)
amazing_print (2.0.0)
annotaterb (4.24.0)
activerecord (>= 6.0.0)
activesupport (>= 6.0.0)
Expand Down Expand Up @@ -353,6 +354,10 @@ GEM
rails-html-sanitizer (1.7.1)
loofah (~> 2.25, >= 2.25.2)
nokogiri (>= 1.15.7, != 1.16.7, != 1.16.6, != 1.16.5, != 1.16.4, != 1.16.3, != 1.16.2, != 1.16.1, != 1.16.0.rc1, != 1.16.0)
rails_semantic_logger (5.2.0)
rack
railties (>= 7.2)
semantic_logger (>= 5.1)
railties (8.1.3.1)
actionpack (= 8.1.3.1)
activesupport (= 8.1.3.1)
Expand Down Expand Up @@ -434,6 +439,8 @@ GEM
rexml (~> 3.2, >= 3.2.5)
rubyzip (>= 1.2.2, < 4.0)
websocket (~> 1.0)
semantic_logger (5.1.0)
concurrent-ruby (~> 1.0)
sentry-rails (6.7.0)
railties (>= 5.2.0)
sentry-ruby (~> 6.7.0)
Expand Down Expand Up @@ -524,6 +531,7 @@ PLATFORMS

DEPENDENCIES
administrate (~> 1.0.0)
amazing_print
annotaterb
awesome_print
barnes
Expand Down Expand Up @@ -552,6 +560,7 @@ DEPENDENCIES
puma (>= 5.0)
rack-cors
rails (~> 8.1.0)
rails_semantic_logger
rubocop
rubocop-capybara
rubocop-graphql
Expand Down
11 changes: 9 additions & 2 deletions config/environments/development.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,14 @@
# Set localhost to be used by links generated in mailer templates.
config.action_mailer.default_url_options = { host: "localhost", port: 3000 }

# Log configuration for rails_semantic_logger
config.rails_semantic_logger.appenders do |appenders|
multiline = ENV.fetch("SEMANTIC_LOGGER_MULTILINE", "true").downcase == "true"
appenders.add_server(
formatter: {color: {ap: {multiline: multiline}}}
)
end
Comment thread
JPrevost marked this conversation as resolved.

# Print deprecation notices to the Rails logger.
config.active_support.deprecation = :log

Expand Down Expand Up @@ -70,8 +78,7 @@
# Raise error when a before_action's only/except options reference missing actions.
config.action_controller.raise_on_missing_callback_actions = true

# Local logging overrides
config.logger = Logger.new(STDOUT)
# Local logging level
config.log_level = :info

# Apply autocorrection by RuboCop to files generated by `bin/rails generate`.
Expand Down
9 changes: 5 additions & 4 deletions config/environments/production.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,11 @@
# Skip http-to-https redirect for the default health check endpoint.
# config.ssl_options = { redirect: { exclude: ->(request) { request.path == "/up" } } }

# 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 configuration for rails_semantic_logger
SemanticLogger.application = ENV.fetch("RAILS_APP_NAME", "tacos")
config.rails_semantic_logger.appenders do |appenders|
appenders.add(io: $stdout, formatter: :json)
end
Comment thread
JPrevost marked this conversation as resolved.

# Log to STDOUT with the current request id as a default log tag.
config.log_tags = [ :request_id ]
Expand Down