Class: Rack::CommonLoggerXID

Inherits:
CommonLogger
  • Object
show all
Defined in:
lib/unicorn-cuba-base/rack/common_logger_xid.rb

Instance Method Summary collapse

Instance Method Details

#log(env, *args) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
# File 'lib/unicorn-cuba-base/rack/common_logger_xid.rb', line 3

def log(env, *args)
	# this is called after body was sent so it won't be in scope of XIDLogging - setting xid again
	xid = env['xid'] && env['xid'].first.last
	if xid
		@logger.with_meta_context(xid: xid) do
			super(env, *args)
		end
	else
		super(env, *args)
	end
end