当前位置: 首页>>代码示例>>Python>>正文


Python logger.debug函数代码示例

本文整理汇总了Python中misc.Logger.logger.debug函数的典型用法代码示例。如果您正苦于以下问题:Python debug函数的具体用法?Python debug怎么用?Python debug使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了debug函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: elb_listener_cert

def elb_listener_cert(listeners=None):
    res = []
    for listener in listeners:
        if 'Listener' in listener and 'SSLCertificateId' in listener['Listener']:
            res.append(listener['Listener']['SSLCertificateId'])
    logger.debug("Returning certs: %s" % res, )
    return res
开发者ID:s4mur4i,项目名称:char-libv2,代码行数:7,代码来源:elb.py

示例2: gather_information_for_cloudofrmation_parameters

def gather_information_for_cloudofrmation_parameters(stack_data, vpc, ami):
    parameters = []
    env = Misc.get_value_from_array_hash(dictlist=vpc.get('Tags'), key="Environment")
    if 'cloudformation_parameters' in stack_data:
        for parameter in stack_data['cloudformation_parameters']:
            if parameter["ParameterKey"] == "Environment":
                parameters.append({"ParameterKey": "Environment", "ParameterValue": env, "UsePreviousValue": False})
            elif parameter["ParameterKey"] == "InstanceType":
                instance = None
                if 'instance_type' in stack_data and env in stack_data['instance_type']:
                    instance = stack_data["instance_type"][env]
                else:
                    instance = Misc.get_value_from_array_hash(dictlist=ami.get('Tags'), key="Instancetype")
                parameters.append(
                    {"ParameterKey": "InstanceType", "ParameterValue": instance, "UsePreviousValue": False})
            elif parameter["ParameterKey"] == "Puppetrole":
                parameters.append({"ParameterKey": "Puppetrole", "ParameterValue": stack_data['puppet_role'],
                                   "UsePreviousValue": False})
            elif parameter["ParameterKey"] == "XivelyService":
                parameters.append({"ParameterKey": "XivelyService", "ParameterValue": stack_data['xively_service'],
                                   "UsePreviousValue": False})
            elif parameter["ParameterKey"] == "Ami":
                parameters.append(
                    {"ParameterKey": "Ami", "ParameterValue": stack_data['ami'], "UsePreviousValue": False})
            elif parameter["ParameterKey"] == "KeyName":
                key = Misc.get_value_from_array_hash(dictlist=vpc.get('Tags'), key="Keypair")
                parameters.append({"ParameterKey": "KeyName", "ParameterValue": key, "UsePreviousValue": False})
            else:
                parameter["UsePreviousValue"] = False
                parameters.append(parameter)
    else:
        logger.warning(msg="No cloudformation parameter object in json")
    logger.debug(msg="Cloudformation parameters is: %s" % (parameters,))
    return parameters
开发者ID:s4mur4i,项目名称:char-libv2,代码行数:34,代码来源:Translater.py

示例3: get_subnet_with_algorithym

 def get_subnet_with_algorithym(self, puppet_role, subnets, num, fillup, xively_service):
     """
     This function returns subnets in order they should be used to fill up
     accordng to requested algorithym
     :param puppet_role: the puppet role of the requested instances
     :param subnets: all the subnets that are avaiable
     :param num: The number of subnets we should return
     :param fillup: Should fillup or round robin algorithym be used
     :param xively_service: the xively service of the requested instance
     :return: a list of instances in order they should be used
     """
     ordered = {}
     for subnet in subnets:
         instances = self.get_ec2_instances(filters=[{'Name': 'tag:Puppet_role', 'Values': [puppet_role]},
                                                     {'Name': 'tag:Xively_service', 'Values': [xively_service]},
                                                     {'Name': 'subnet-id', 'Values': [subnet.get('SubnetId')]}])
         ordered[subnet.get('SubnetId')] = len(instances)
     ordered = sorted(ordered.items(), key=operator.itemgetter(1))
     logger.debug("The ordered subnet list is: %s" % (str(ordered),))
     ret = []
     for i in range(0, num):
         if fillup:
             cur = ordered.pop(0)
             ret.append(cur[0])
             tmp = {}
             for item in ordered:
                 tmp[item[0]] = item[1]
             tmp[cur[0]] = cur[1] + 1
             ordered = sorted(tmp.items(), key=operator.itemgetter(1))
         else:
             mod = i % len(ordered)
             ret.append(ordered[mod][0])
     return ret
开发者ID:s4mur4i,项目名称:char-libv2,代码行数:33,代码来源:ec2.py

示例4: query_information

 def query_information(self, query):
     '''
     This function is used to print debug information about a query, to see if it was succesful or not
     :param query: The boto3 query
     :return: Query with removed metadata
     '''
     if query['ResponseMetadata']['HTTPStatusCode'] == 201:
         logger.debug("Resource was succesfully created")
         logger.info("Query RequestID: %s, HTTPStatusCode: %s" % (
             query['ResponseMetadata']['RequestId'], query['ResponseMetadata']['HTTPStatusCode']))
     elif query['ResponseMetadata']['HTTPStatusCode'] == 202:
         logger.debug('Request accepted but processing later.')
         logger.info("Query RequestID: %s, HTTPStatusCode: %s" % (
             query['ResponseMetadata']['RequestId'], query['ResponseMetadata']['HTTPStatusCode']))
     elif query['ResponseMetadata']['HTTPStatusCode'] == 204:
         logger.debug('Request done but no content returned.')
         logger.info("Query RequestID: %s, HTTPStatusCode: %s" % (
             query['ResponseMetadata']['RequestId'], query['ResponseMetadata']['HTTPStatusCode']))
     elif query['ResponseMetadata']['HTTPStatusCode'] != 200:
         logger.warning('There was an issue with request.')
         logger.warning("Query RequestID: %s, HTTPStatusCode: %s" % (
             query['ResponseMetadata']['RequestId'], query['ResponseMetadata']['HTTPStatusCode']))
     else:
         logger.debug("Request had no issues")
         logger.debug("Query RequestID: %s, HTTPStatusCode: %s" % (
             query['ResponseMetadata']['RequestId'], query['ResponseMetadata']['HTTPStatusCode']))
     query.pop('ResponseMetadata')
     if 'NextToken' in query:
         logger.error("Token is present. Paging needs to be implemented")
     return query
开发者ID:s4mur4i,项目名称:char-libv2,代码行数:30,代码来源:wrapper_base.py

示例5: recieve_msg

 def recieve_msg(self, url=None, filter=None):
     logger.debug("Recieving messages for url : %s" % (url,))
     if filter:
         resp = self.boto3.recieve_message(QueueUrl=url, MessageAttributeNames=filter)
     else:
         resp = self.boto3.recieve_message(QueueUrl=url)
     return resp['Messages']
开发者ID:s4mur4i,项目名称:char-libv2,代码行数:7,代码来源:sqs.py

示例6: create_integration

 def create_integration(self, restid, resourceid, method, integration_type, further_opts=None):
     """
     This function creates an integration object
     :param method: the method that is requested
     :type method: basestring
     :param restid: the id of the rest api object
     :type restid: basestring
     :param resourceid: id of a single resource object
     :type resourceid: basestring
     :param integration_type: an enum of the integration type
     :type integration_type: basestring
     :param further_opts: This opt passes in json_data fur not mandatory options
     :type further_opts: dict
     :return: object of the created  integration
     """
     if self.dryrun:
         logger.info("Dryrun requested no changes will be done")
         return None
     opts = {'restApiId': restid, 'resourceId': resourceid, 'httpMethod': method, 'type': integration_type,
             'integrationHttpMethod': method}
     # There is aws cli bug and integrationHttpMethod also needs to be added. may change later
     #        opts = {'restApiId': restid, 'resourceId': resourceid, 'httpMethod': method, 'type': integration_type}
     for element in ['integrationHttpMethod', 'uri', 'credentials', 'requestParameters', 'requestTemplates',
                     'cacheNamespace', 'cacheNamespace']:
         if element in further_opts:
             opts[element] = further_opts[element]
     logger.debug("The opts for integration object creation: %s" % opts)
     resp = self.apigateway_client.put_integration(**opts)
     super(Apigateway, self).query_information(query=resp)
     return resp
开发者ID:s4mur4i,项目名称:char-libv2,代码行数:30,代码来源:apigateway.py

示例7: create_method_response

 def create_method_response(self, restid, resourceid, method, statuscode, further_ops):
     """
     This function creates a method response
     :param method: the method that is requested
     :type method: basestring
     :param restid: the id of the rest api object
     :type restid: basestring
     :param resourceid: id of a single resource object
     :type resourceid: basestring
     :param statuscode: the status code
     :type statuscode: basestring
     :param further_opts: This opt passes in json_data fur not mandatory options
     :type further_opts: dict
     :return: the created method response object
     """
     if self.dryrun:
         logger.info("Dryrun requested no changes will be done")
         return None
     opts = {'restApiId': restid, 'resourceId': resourceid, 'httpMethod': method, 'statusCode': statuscode}
     if 'responseParameters' in further_ops:
         opts['responseParameters'] = further_ops['responseParameters']
     if 'responseModels' in further_ops:
         opts['responseModels'] = further_ops['responseModels']
     logger.debug("The opts sent to create method response %s" % opts)
     resp = self.apigateway_client.put_method_response(**opts)
     super(Apigateway, self).query_information(query=resp)
     return resp
开发者ID:s4mur4i,项目名称:char-libv2,代码行数:27,代码来源:apigateway.py

示例8: create_integration_response

 def create_integration_response(self, restid, resourceid, method, statuscode, further_opts=None):
     """
     This function creates an integration response object
     :param method: the method that is requested
     :type method: basestring
     :param restid: the id of the rest api object
     :type restid: basestring
     :param resourceid: id of a single resource object
     :type resourceid: basestring
     :param statuscode: thestatus code to attach integration response
     :type statuscode: basestring
     :param further_opts: This opt passes in json_data fur not mandatory options
     :type further_opts: dict
     :return:
     """
     if self.dryrun:
         logger.info("Dryrun requested no changes will be done")
         return None
     opts = {'restApiId': restid, 'resourceId': resourceid, 'httpMethod': method, 'statusCode': statuscode}
     for element in ['selectionPattern', 'responseParameters', 'responseTemplates']:
         if element in further_opts:
             if further_opts[element] == "None":
                 opts[element] = None
             else:
                 opts[element] = further_opts[element]
     logger.debug("The opts sent to create integration response %s" % opts)
     resp = self.apigateway_client.put_integration_response(**opts)
     super(Apigateway, self).query_information(query=resp)
     return resp
开发者ID:s4mur4i,项目名称:char-libv2,代码行数:29,代码来源:apigateway.py

示例9: create_method

 def create_method(self, restid, resourceid, method, authorizationtype, apikeyreq=False, further_opts=None):
     """
     This function creates a method object
     :param method: the method that is requested
     :type method: basestring
     :param restid: the id of the rest api object
     :type restid: basestring
     :param resourceid: id of a single resource object
     :type resourceid: basestring
     :param authorizationtype:
     :type authorizationtype: basestring
     :param apikeyreq: should apikey be required
     :type apikeyreq: bool
     :param further_opts: This opt passes in json_data fur not mandatory options
     :type further_opts: dict
     :return: the created method object
     """
     if self.dryrun:
         logger.info("Dryrun requested no changes will be done")
         return None
     if isinstance(apikeyreq, bool) is False:
         logger.debug("apikey is not boolean, converting")
         apikeyreq = Misc.str2bool(apikeyreq)
     opts = {'restApiId': restid, 'resourceId': resourceid, 'httpMethod': method,
             'authorizationType': authorizationtype, 'apiKeyRequired': apikeyreq}
     if 'requestParameters' in further_opts:
         opts['requestParameters'] = further_opts['requestParameters']
     if 'requestModels' in further_opts:
         opts['requestModels'] = further_opts['requestModels']
     logger.debug("The opts sent to create method %s" % opts)
     resp = self.apigateway_client.put_method(**opts)
     super(Apigateway, self).query_information(query=resp)
     return resp
开发者ID:s4mur4i,项目名称:char-libv2,代码行数:33,代码来源:apigateway.py

示例10: get_method_response

 def get_method_response(self, restid, resourceid, method, statuscode):
     """
     This function returns a method response object
     :param method: the method that is requested
     :type method: basestring
     :param restid: the id of the rest api object
     :type restid: basestring
     :param resourceid: id of a single resource object
     :type resourceid: basestring
     :param statuscode: the statuscode requested
     :type statuscode: basestring
     :return: None if not found, else the object
     """
     try:
         ret = self.apigateway_client.get_method_response(restApiId=restid, resourceId=resourceid, httpMethod=method,
                                                          statusCode=statuscode)
         super(Apigateway, self).query_information(query=ret)
         logger.debug("We found the method response")
     except Exception as e:
         # https://github.com/aws/aws-cli/issues/1620
         if e.response['Error']['Code'] == "NotFoundException":
             logger.warning("Method response %s for resource %s does not exist" % (statuscode, resourceid))
         else:
             logger.error("%s" % e, )
         ret = None
     return ret
开发者ID:s4mur4i,项目名称:char-libv2,代码行数:26,代码来源:apigateway.py

示例11: send_msg

 def send_msg(self, msg=None, url=None, attribs=None):
     logger.debug("Sending msg %s to %s" % (msg, url))
     if attribs:
         resp = self.boto3.send_message(QueueUrl=url, MessageBody=msg, attribs=attribs)
     else:
         resp = self.boto3.send_message(QueueUrl=url, MessageBody=msg)
     logger.debug("Message details: Md5: %s, MsgID: %s" % (resp['MD5OfMessageBody'], resp['MessageId']))
开发者ID:s4mur4i,项目名称:char-libv2,代码行数:7,代码来源:sqs.py

示例12: __init__

 def __init__(self, session):
     """
     This function creates the initial client and resource objects
     :param session: a boto3 session object for connecting to aws
     :return: a wrapper.Elb object for running wrapper commands
     """
     logger.debug("Starting Elb wrapper")
     self.elb_client = session.client(service_name="elb")
开发者ID:s4mur4i,项目名称:char-libv2,代码行数:8,代码来源:elb.py

示例13: __init__

 def __init__(self):
     logger.debug("Starting Class for Cloudwatch")
     try:
         config_file = open("%s/etc/aws.conf" % (os.environ['KERRIGAN_ROOT'],), 'r')
         self.yaml = yaml.load(config_file)
     except IOError as e:
         logger.error("aws.conf I/O error({0}): {1}".format(e.errno, e.strerror))
     self.cloudwatch = boto3.client('cloudwatch', region_name='us-east-1')
开发者ID:s4mur4i,项目名称:char-libv2,代码行数:8,代码来源:cloudwatch.py

示例14: __init__

 def __init__(self, session):
     '''
     This function creates the initial client and resource objects
     :param session: a boto3 session object for connecting to aws
     :return: a wrapper.S3 object for running wrapper commands
     '''
     logger.debug("Starting iam wrapper")
     self.s3_client = session.client(service_name="s3")
     self.s3_resource = session.resource(service_name="s3")
开发者ID:s4mur4i,项目名称:char-libv2,代码行数:9,代码来源:s3.py

示例15: translate_security_group_ip_address_in_cloudformation

def translate_security_group_ip_address_in_cloudformation(cloudformation_json, env_cidr):
    for resource_name in cloudformation_json['Resources']:
        logger.debug(msg="Iterating over %s for sg translation" % (resource_name,))
        if 'Type' not in cloudformation_json['Resources'][resource_name] or 'AWS::EC2::SecurityGroup' != \
                cloudformation_json['Resources'][resource_name]['Type']:
            continue
        cloudformation_json['Resources'][resource_name] = translate_security_group(
            security_group=cloudformation_json['Resources'][resource_name], env_cidr=env_cidr)
    return cloudformation_json
开发者ID:s4mur4i,项目名称:char-libv2,代码行数:9,代码来源:Translater.py


注:本文中的misc.Logger.logger.debug函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。