Skip to content
Browse files

Revert "Merge pull request #7084 from LTe/logger_default_separator"

This reverts commit c08f30f, reversing
changes made to e243a8a.
  • Loading branch information...
1 parent fe5b943 commit e482100d6ed022d00ba31c6c4377f6f947173337 @tenderlove tenderlove committed
Showing with 3 additions and 14 deletions.
  1. +1 −1 activesupport/lib/active_support/tagged_logging.rb
  2. +2 −13 activesupport/test/tagged_logging_test.rb
View
2 activesupport/lib/active_support/tagged_logging.rb
@@ -31,7 +31,7 @@ def current_tags
def tags_text
tags = current_tags
if tags.any?
- tags.collect { |tag| "[#{tag}] " }.join('')
+ tags.collect { |tag| "[#{tag}] " }.join
end
end
end
View
15 activesupport/test/tagged_logging_test.rb
@@ -10,13 +10,8 @@ def flush(*)
end
setup do
- @output = StringIO.new
- @logger = ActiveSupport::TaggedLogging.new(MyLogger.new(@output))
- @separator = $,
- end
-
- after do
- $, = @separator
+ @output = StringIO.new
+ @logger = ActiveSupport::TaggedLogging.new(MyLogger.new(@output))
end
test "tagged once" do
@@ -74,10 +69,4 @@ def flush(*)
assert_equal "[BCX] [Jason] Funky time\n[BCX] Junky time!\n", @output.string
end
-
- test "using the correct separator" do
- $, = "_"
- @logger.tagged("BCX", "BDX") { @logger.info "Funky time" }
- assert_equal "[BCX] [BDX] Funky time\n", @output.string
- end
end

5 comments on commit e482100

@rafaelfranca
Ruby on Rails member

Reason?

@steveklabnik
Ruby on Rails member

I wasn't involved in this discussion, but $, should absolutely be respected. We're not making a custom Ruby for Rails...

@tenderlove
Ruby on Rails member

If you modify a global variable, it modifies the behavior of the program, globally.

People who never set the global variable would not notice the "fix" in the previous commit. People who depended on the global variable would have broken code. Best case: nobody would notice the commit, worst case: we broke someone's code.

@tenderlove
Ruby on Rails member

TBH, a better argument to not use the $, (in this case), would be that the current code ends up with a blank space at the end of the string. It would be better if the code was changed to tags.collect { |tag| "[#{tag}]" }.join ' '.

@rafaelfranca
Ruby on Rails member

seems good. Thank you to explain.

Please sign in to comment.
Something went wrong with that request. Please try again.