DEV: Log to STDOUT if RAILS_ENABLE_TEST_LOG (#8650)

The env var `RAILS_ENABLE_TEST_LOG` didn't seem to do anything if enabled. This now sets the logger to STDOUT if `RAILS_ENABLE_TEST_LOG` is enabled and also introduces `RAILS_TEST_LOG_LEVEL` so the level of the logging in the console can be provided (default info).

Note: I am not sure if the original behaviour is expected. I can add an additional env var to enable the STDOUT logging if required
This commit is contained in:
Martin Brennan 2020-01-03 09:58:01 +10:00 committed by GitHub
parent ec5418fbb4
commit 2050238d0c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 1 deletions

View File

@ -47,7 +47,10 @@ Discourse::Application.configure do
config.eager_load = false
unless ENV['RAILS_ENABLE_TEST_LOG']
if ENV['RAILS_ENABLE_TEST_LOG']
config.logger = Logger.new(STDOUT)
config.log_level = ENV['RAILS_TEST_LOG_LEVEL'].present? ? ENV['RAILS_TEST_LOG_LEVEL'].to_sym : :info
else
config.logger = Logger.new(nil)
config.log_level = :fatal
end