lib/log_sanity/railtie.rb in log_sanity-1.0.0 vs lib/log_sanity/railtie.rb in log_sanity-1.1.0
- old
+ new
@@ -8,10 +8,14 @@
initializer "log_sanity.configure" do |app|
app.config.log_tags ||= []
if app.config.logsanity.enabled
orig_formatter = Rails.logger.formatter
Rails.logger.formatter = LogSanity::Formatter.new
- Rails.logger.formatter.string_formatter = orig_formatter unless app.config.logsanity.json_strings
+ if app.config.logsanity.json_strings
+ Rails.logger.formatter.string_formatter = false
+ else
+ Rails.logger.formatter.string_formatter = orig_formatter if orig_formatter
+ end
if defined?(ActionController)
require 'action_controller/log_subscriber'
ActionController::LogSubscriber.detach_from :action_controller
end