aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJosé Valim <jose.valim@gmail.com>2012-08-23 10:59:42 -0300
committerJosé Valim <jose.valim@gmail.com>2012-08-23 11:01:55 -0300
commit891043d5d0d097fc51c3fccdfa563c3ba52b7f55 (patch)
tree76598db83b405c2d50baf1ba7cf0e3feb60fc756
parente8eb68c19a423362f7c5fc3fea09803367d764d4 (diff)
downloadrails-891043d5d0d097fc51c3fccdfa563c3ba52b7f55.tar.gz
rails-891043d5d0d097fc51c3fccdfa563c3ba52b7f55.tar.bz2
rails-891043d5d0d097fc51c3fccdfa563c3ba52b7f55.zip
Revert "Use join without default separator"
This reverts commit b0ab8dc0b2b0f580ffe5ac9ff57fd13152e18577 because it was removing the contents of the message when we did not have any tag. A test case is also committed.
-rw-r--r--activesupport/lib/active_support/tagged_logging.rb4
-rw-r--r--activesupport/test/tagged_logging_test.rb5
2 files changed, 7 insertions, 2 deletions
diff --git a/activesupport/lib/active_support/tagged_logging.rb b/activesupport/lib/active_support/tagged_logging.rb
index 9cd8ac36bc..5e080df518 100644
--- a/activesupport/lib/active_support/tagged_logging.rb
+++ b/activesupport/lib/active_support/tagged_logging.rb
@@ -16,7 +16,7 @@ module ActiveSupport
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 @@ module ActiveSupport
def tags_text
tags = current_tags
if tags.any?
- tags.collect { |tag| "[#{tag}]" }.join(' ')
+ tags.collect { |tag| "[#{tag}] " }.join
end
end
end
diff --git a/activesupport/test/tagged_logging_test.rb b/activesupport/test/tagged_logging_test.rb
index 0751c2469e..43cf1a8e4f 100644
--- a/activesupport/test/tagged_logging_test.rb
+++ b/activesupport/test/tagged_logging_test.rb
@@ -29,6 +29,11 @@ class TaggedLoggingTest < ActiveSupport::TestCase
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