Working on major restructuring
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
module GameServer
|
||||
module Logging
|
||||
module Context
|
||||
def self.with(data)
|
||||
old = Thread.current[:log_ctx]
|
||||
Thread.current[:log_ctx] = data
|
||||
yield
|
||||
ensure
|
||||
Thread.current[:log_ctx] = old
|
||||
end
|
||||
|
||||
def self.current
|
||||
ctx = Thread.current[:log_ctx]
|
||||
ctx ? ctx.map { |k,v| "#{k}=#{v} " }.join : ""
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user