Skip to content

Commit 891043d

Browse files
committed
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.
1 parent e8eb68c commit 891043d

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

activesupport/lib/active_support/tagged_logging.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ module TaggedLogging
1616
module Formatter # :nodoc:
1717
# This method is invoked when a log event occurs
1818
def call(severity, timestamp, progname, msg)
19-
super(severity, timestamp, progname, "#{tags_text} #{msg}".lstrip)
19+
super(severity, timestamp, progname, "#{tags_text}#{msg}")
2020
end
2121

2222
def clear!
@@ -31,7 +31,7 @@ def current_tags
3131
def tags_text
3232
tags = current_tags
3333
if tags.any?
34-
tags.collect { |tag| "[#{tag}]" }.join(' ')
34+
tags.collect { |tag| "[#{tag}] " }.join
3535
end
3636
end
3737
end

activesupport/test/tagged_logging_test.rb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,11 @@ def flush(*)
2929
assert_equal "[BCX] [Jason] [New] Funky time\n", @output.string
3030
end
3131

32+
test "does not strip message content" do
33+
@logger.info " Hello"
34+
assert_equal " Hello\n", @output.string
35+
end
36+
3237
test "provides access to the logger instance" do
3338
@logger.tagged("BCX") { |logger| logger.info "Funky time" }
3439
assert_equal "[BCX] Funky time\n", @output.string

0 commit comments

Comments
 (0)