mirror of
https://github.com/discourse/discourse.git
synced 2024-11-22 09:42:02 +08:00
collect extra environment correctly
This commit is contained in:
parent
075d80862f
commit
6cae47aa53
|
@ -504,12 +504,18 @@ module Discourse
|
|||
loggers.concat(Rails.logger.chained)
|
||||
end
|
||||
|
||||
logster_env = env
|
||||
|
||||
if old_env = Thread.current[Logster::Logger::LOGSTER_ENV]
|
||||
env = env.merge(old_env)
|
||||
logster_env = Logster::Message.populate_from_env(old_env)
|
||||
|
||||
# a bit awkward by try to keep the new params
|
||||
env.each do |k, v|
|
||||
logster_env[k] = v
|
||||
end
|
||||
end
|
||||
|
||||
loggers.each do |logger|
|
||||
|
||||
if !(Logster::Logger === logger)
|
||||
logger.warn("#{message} #{append}")
|
||||
next
|
||||
|
@ -519,9 +525,18 @@ module Discourse
|
|||
::Logger::Severity::WARN,
|
||||
"discourse",
|
||||
message,
|
||||
env: env
|
||||
env: logster_env
|
||||
)
|
||||
end
|
||||
|
||||
if old_env
|
||||
env.each do |k, v|
|
||||
# do not leak state
|
||||
logster_env.delete(k)
|
||||
end
|
||||
end
|
||||
|
||||
nil
|
||||
end
|
||||
|
||||
# report a warning maintaining backtrack for logster
|
||||
|
|
Loading…
Reference in New Issue
Block a user