def _remote_logging(original):
 @wraps(original)
 def logger(self, request, **routeArguments):
  serialized_remote_task = request.requestHeaders.getRawHeaders('X-Eliot-Task-Id', [None])[0]
  if (serialized_remote_task is None):
   return original(self, request, **routeArguments)
  try:
   action = Action.continue_task(task_id=serialized_remote_task)
  except ValueError:
   return original(self, request, **routeArguments)
  with action.context():
   d = DeferredContext(original(self, request, **routeArguments))
   d.addActionFinish()
   return d.result
 return logger

def _remote_logging ( original ) : @ wraps ( original ) def logger ( self , request , ** routeArguments ) : serialized_remote_task = request . requestHeaders . getRawHeaders ( 'X-Eliot-Task-Id' , [ None ] ) [ 0 ] if ( serialized_remote_task is None ) : return original ( self , request , ** routeArguments ) try : action = Action . continue_task ( task_id = serialized_remote_task ) except ValueError : return original ( self , request , ** routeArguments ) with action . context ( ) : d = DeferredContext ( original ( self , request , ** routeArguments ) ) d . addActionFinish ( ) return d . result return logger
decorate a method which implements an api endpoint to do eliot-based log tracing; that is .