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