Permalink
Browse files

Merge pull request #7084 from LTe/logger_default_separator

Don't use default separator in tagged logger
  • Loading branch information...
2 parents e243a8a + dc97a9a commit c08f30ff5fcda7e07cd9275a073acb2091e4b3f7 @josevalim josevalim committed Jul 18, 2012
Showing with 14 additions and 3 deletions.
  1. +1 −1 activesupport/lib/active_support/tagged_logging.rb
  2. +13 −2 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,8 +10,13 @@ def flush(*)
end
setup do
- @output = StringIO.new
- @logger = ActiveSupport::TaggedLogging.new(MyLogger.new(@output))
+ @output = StringIO.new
+ @logger = ActiveSupport::TaggedLogging.new(MyLogger.new(@output))
+ @separator = $,
+ end
+
+ after do
+ $, = @separator
end
test "tagged once" do
@@ -69,4 +74,10 @@ 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

0 comments on commit c08f30f

Please sign in to comment.