def recv_log(self, message=None, level='info'):
     if message:
         source = get_request_meta().get('source', 'unknown')
         source_environment = get_request_meta().get('source_environment', DEFAULT_ENVIRONMENT)
         request_id = get_request_meta().get('request_id') or '-'
         getattr(self.log, level)(
             "[%s_%s] %s %s" % (source_environment, source, request_id, message))
         return True
     return False
Beispiel #2
0
 def recv_log(self, message=None, level='info'):
     if message:
         source = get_request_meta().get('source', 'unknown')
         source_environment = get_request_meta().get(
             'source_environment', DEFAULT_ENVIRONMENT)
         request_id = get_request_meta().get('request_id') or '-'
         getattr(self.log,
                 level)("[%s_%s] %s %s" %
                        (source_environment, source, request_id, message))
         return True
     return False
Beispiel #3
0
 def set_custom_environment(self, query_dict):
     if "environment" in query_dict:
         # environments set in the request should be
         # stored in request_meta, not server_meta.
         # Storing environment in request_meta will
         # propagate it to other services as well.
         environment = query_dict['environment'][-1]
         get_request_meta()['environment'] = environment
         self.log.info('Using custom environment: %s' % environment)
         return environment
 def set_custom_environment(self, query_dict):
     if "environment" in query_dict:
         # environments set in the request should be
         # stored in request_meta, not server_meta.
         # Storing environment in request_meta will
         # propagate it to other services as well.
         environment = query_dict['environment'][-1]
         get_request_meta()['environment'] = environment
         self.log.info('Using custom environment: %s' % environment)
         return environment
Beispiel #5
0
 def set_custom_endpoints(self, query_dict):
     # custom enpoint information travels on in request_meta
     custom_endpoints = {}
     for key in query_dict.keys():
         if key.startswith(ENDPOINT_OVERRIDE_PREFIX):
             endpoint = key[(len(ENDPOINT_OVERRIDE_PREFIX)):]
             custom_endpoints[endpoint] = query_dict[key][-1]
     if custom_endpoints:
         get_request_meta()['custom_endpoints'] = custom_endpoints
         self.log.info('Using custom endpoints: %s' % str(custom_endpoints))
     return custom_endpoints
 def set_custom_endpoints(self, query_dict):
     # custom enpoint information travels on in request_meta
     custom_endpoints = {}
     for key in query_dict.keys():
         if key.startswith(ENDPOINT_OVERRIDE_PREFIX):
             endpoint = key[(len(ENDPOINT_OVERRIDE_PREFIX)):]
             custom_endpoints[endpoint] = query_dict[key][-1]
     if custom_endpoints:
         get_request_meta()['custom_endpoints'] = custom_endpoints
         self.log.info('Using custom endpoints: %s' % str(custom_endpoints))
     return custom_endpoints