• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python logger.debug函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: __init__

 def __init__(self, arguments):
     """
     This function creates the initial client and resource objects
     :param arguments: Arguments for a boto3 session object
     :type arguments: dict
     :return: a boto3.session object for wrapper commands
     """
     logger.debug("Starting Session object")
     self.session = boto3.session.Session(**arguments)
开发者ID:s4mur4i,项目名称:char-libv2,代码行数:9,代码来源:session.py


示例17: validate_kerrigan_json

def validate_kerrigan_json(stack_data, env):
    # do some tests
    logger.debug(msg="Validating if stack can be deployed to env")
    if 'envs' in stack_data and env in stack_data['envs']:
        logger.info(msg="Stack can be deployed to environment %s" % (env,))
    else:
        logger.error(msg="Stack should not be deployed to Environment %s" % (env,))
        exit(20)
    return stack_data
开发者ID:s4mur4i,项目名称:char-libv2,代码行数:9,代码来源:Validator.py


示例18: __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.Autoscale object for running wrapper commands
     """
     logger.debug("Starting Autoscale wrapper")
     self.autoscale_client = session.client(service_name="autoscale")
     self.autoscale_resource = session.resource(service_name="autoscale")
开发者ID:s4mur4i,项目名称:char-libv2,代码行数:9,代码来源:autoscale.py


示例19: __init__

 def __init__(self, session, dryrun=False):
     '''
     This function creates the initial client and resource objects
     :param session: a boto3 session object for connecting to aws
     :return: a wrapper.Dynamodb object for running wrapper commands
     '''
     logger.debug("Starting apigateway wrapper")
     self.apigateway_client = session.client(service_name="apigateway")
     self.dryrun = dryrun
     logger.debug("Dryrun value is %s" % self.dryrun)
开发者ID:s4mur4i,项目名称:char-libv2,代码行数:10,代码来源:apigateway.py


示例20: get_elb_from_env

 def get_elb_from_env(self, env=None):
     v = Vpc()
     vpc = v.get_vpc_from_env(env=env)
     elbs = self.get_all_elbs()
     ret = []
     for elb in elbs:
         if elb['VPCId'] == vpc.get('VpcId'):
             ret.append(elb)
     logger.debug("Elbs in env %s : %s" % (env, ret))
     return ret
开发者ID:s4mur4i,项目名称:char-libv2,代码行数:10,代码来源:elb.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python logger.info函数代码示例发布时间:2022-05-27
下一篇:
Python ExtMap.ExtMap类代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap