提交 891043d5 编写于 作者: J José Valim

Revert "Use join without default separator"

This reverts commit b0ab8dc0
because it was removing the contents of the message when we
did not have any tag. A test case is also committed.
上级 e8eb68c1
......@@ -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
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册