Permalink
Browse files

Revert "Use join without default separator"

This reverts commit b0ab8dc
because it was removing the contents of the message when we
did not have any tag. A test case is also committed.
  • Loading branch information...
1 parent e8eb68c commit 891043d5d0d097fc51c3fccdfa563c3ba52b7f55 @josevalim josevalim committed Aug 23, 2012
Showing with 7 additions and 2 deletions.
  1. +2 −2 activesupport/lib/active_support/tagged_logging.rb
  2. +5 −0 activesupport/test/tagged_logging_test.rb
@@ -16,7 +16,7 @@ module TaggedLogging
module Formatter # :nodoc:
# This method is invoked when a log event occurs
def call(severity, timestamp, progname, msg)
- super(severity, timestamp, progname, "#{tags_text} #{msg}".lstrip)
+ super(severity, timestamp, progname, "#{tags_text}#{msg}")
end
def clear!
@@ -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
@@ -29,6 +29,11 @@ def flush(*)
assert_equal "[BCX] [Jason] [New] Funky time\n", @output.string
end
+ test "does not strip message content" do
+ @logger.info " Hello"
+ assert_equal " Hello\n", @output.string
+ end
+
test "provides access to the logger instance" do
@logger.tagged("BCX") { |logger| logger.info "Funky time" }
assert_equal "[BCX] Funky time\n", @output.string

0 comments on commit 891043d

Please sign in to comment.