提交 6e76f8f5 编写于 作者: S Sergey Nartimov

use thread variable in TaggedLogging

previous solution can cause race conditions under GIL-free ruby implementations
上级 247d274c
......@@ -14,7 +14,6 @@ module ActiveSupport
class TaggedLogging
def initialize(logger)
@logger = logger
@tags = Hash.new { |h,k| h[k] = [] }
end
def tagged(*new_tags)
......@@ -39,7 +38,7 @@ def #{severity}(progname = nil, &block) # def warn(progname = nil,
end
def flush
@tags.delete(Thread.current)
current_tags.clear
@logger.flush if @logger.respond_to?(:flush)
end
......@@ -57,7 +56,7 @@ def tags_text
end
def current_tags
@tags[Thread.current]
Thread.current[:activesupport_tagged_logging_tags] ||= []
end
end
end
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册