Skip to content

Commit

Permalink
Ignore Style/GlobalVars
Browse files Browse the repository at this point in the history
  • Loading branch information
barrucadu committed Jul 20, 2020
1 parent 6efd239 commit c1739f6
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/govuk_app_config/govuk_logging.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,11 @@ def self.configure
#
# To resolve this we've directed stdout to stderr, to cover any Rails
# writing. This frees up the normal stdout for the logstasher logs.

# rubocop:disable Style/GlobalVars
$real_stdout = $stdout.clone
$stdout.reopen($stderr)
# rubocop:enable Style/GlobalVars

# Send Rails' logs to STDERR because they're not JSON formatted.
Rails.logger = ActiveSupport::TaggedLogging.new(Logger.new($stderr, level: Rails.logger.level))
Expand Down Expand Up @@ -45,7 +48,7 @@ def self.configure
Rails.application.config.logstasher.job_enabled = false

Rails.application.config.logstasher.logger = Logger.new(
$real_stdout,
$real_stdout, # rubocop:disable Style/GlobalVars
level: Rails.logger.level,
formatter: proc { |_severity, _datetime, _progname, msg|
"#{String === msg ? msg : msg.inspect}\n"
Expand Down

0 comments on commit c1739f6

Please sign in to comment.