Module: MrLogaLoga::Extensions::RailsExtension::ServerPatch

Defined in:
lib/mr_loga_loga/extensions/rails.rb

Overview

This patches the server command so that console output will use the same logger you previously configured

Instance Method Summary collapse

Instance Method Details

#log_to_stdoutObject



125
126
127
128
129
130
131
132
133
134
135
# File 'lib/mr_loga_loga/extensions/rails.rb', line 125

def log_to_stdout
  wrapped_app # touch the app so the logger is set up

  console = Rails.logger.class.new(STDOUT)
  console.formatter = Rails.logger.formatter
  console.level = Rails.logger.level

  unless ActiveSupport::Logger.logger_outputs_to?(Rails.logger, STDOUT)
    Rails.logger.extend(ActiveSupport::Logger.broadcast(console))
  end
end