aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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