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

Python logger.debug函数代码示例

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

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



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

示例1: do_add

    def do_add(self, tqname=None, namespace='mobile', account=1, version=1, payload=None, tags=None, priority='low', delay=0):
        '''
        Insert one task into the specific task queue.

        Params:
            tqname: Name of task queue.
            namespace: Namespace of the task queue.
            account: Account ID.
            version: Version of the resource, default value 1.
            payload: Base64 encode string.
            tags: Tags in the task.
            priority: Priority of the task.
            delay: If delay is set, the lease request will not see the added task in [delay] seconds.

        Return:
            Instance object of class RestResult;
            Exception message
        '''
        assert(tqname)
        resource = TQRES_TEMPLATE_STR % (version, account, namespace, tqname)
        resource = '/'.join([resource, 'addtask'])
        if delay > 0:
            resource += '?delay=%s' % delay
        data = json.dumps({'payload_base64' : payload, 'tags' : tags, 'priority' : priority}, encoding="utf-8")
        logger.debug('Add task - resource:%s, data:%s' % (resource, data))
        return self.m_wrest.do_access(resource, 'POST', data=data, headers=None)
开发者ID:lls3018,项目名称:mdmi,代码行数:26,代码来源:hosted_taskqueue.py


示例2: do_bulk_add

    def do_bulk_add(self, tqname=None, namespace='mobile', account=1, version=1, taskslist=[]):
        '''
        Insert tasks into the specific task queue.

        Params:
            tqname: Name of task queue.
            namespace: Namespace of the task queue.
            account: Account ID.
            version: Version of the resource, default value 1.
            taskslist: task structures in list. 
                For example: [
                                {
                                    "payload_base64": "TXkgbGl0dGxlIHRhc2sK",
                                    "tags": ["state=red", "watchthis", "code=41"],
                                    "priority" : "high"
                                },
                                ...
                            ]

        Return:
            Instance object of class RestResult;
            Exception message
        '''
        #check data is available
        assert(tqname)
        assert(isinstance(taskslist, list))
        for task in taskslist:
            assert(isinstance(task, dict))
        resource = TQRES_TEMPLATE_STR % (version, account, namespace, tqname)
        resource = '/'.join([resource, 'addtasks'])
        data = json.dumps(taskslist, encoding="utf-8")
        logger.debug('Add %d tasks - resource:%s, data:%s' % (len(taskslist), resource, data))
        return self.m_wrest.do_access(resource, 'POST', data=data, headers=None)
开发者ID:lls3018,项目名称:mdmi,代码行数:33,代码来源:hosted_taskqueue.py


示例3: do_update

    def do_update(self, udid=None, attributes=None):
        '''
        Update one device information to RS

        Params:
            attributes: Attributes of the devicd information.

        Return:
            Instance object of class RestResult;
            Exception message
        '''
        if udid:
            udid_str = str(udid)
        else:
            udid_str = self.m_udid
        if not udid_str:
            raise Exception('Require device UDID!')
        resource = DEVRES_TEMPLATE_STR % (self.m_ver, udid_str)
        if isinstance(attributes, list):
            attr = json.dumps(attributes)
        elif isinstance(attributes, basestring):
            attr = attributes
        else:
            raise Exception('Invalid input!')

        content = {
                        'method':'modify',
                        'params':attributes,
                    }
        data = json.dumps(content)
        wrest = HostedAccess()
        logger.debug('Update device info - resource:%s, data:%s' % (resource, data))
        retval = wrest.do_access(resource, 'POST', data=data, headers=None)
        del wrest
        return retval
开发者ID:lls3018,项目名称:mdmi,代码行数:35,代码来源:hosted_device.py


示例4: do_get_many

    def do_get_many(self, tqname=None, namespace='mobile', account=1, version=1, tasknum=0, tags=None):
        '''
        Get a bulk of tasks' information from the specific task queue.

        Params:
            tqname: Name of task queue.
            namespace: Namespace of the task queue.
            account: Account ID.
            version: Version of the resource, default value 1.
            tasknum: Number of the tasks that expected.
            tags: Search conditions.

        Return:
            Instance object of class RestResult;
            Exception message
        '''
        assert(tqname)
        resource = TQRES_TEMPLATE_STR % (version, account, namespace, tqname)
        resource = '/'.join([resource, 'search?numTasks=%s'])
        resource = resource % tasknum
        resource = '&'.join([resource, 'orderby=priority'])
        if tags:
            data = json.dumps({'tags' : tags}, encoding="utf-8")
        else:
            data = tags
        logger.debug('Get tasks - resource:%s, data:%s' % (resource, data))
        return self.m_wrest.do_access(resource, 'POST', data=data, headers=None)
开发者ID:lls3018,项目名称:mdmi,代码行数:27,代码来源:hosted_taskqueue.py


示例5: move_task_to_errorqueue

    def move_task_to_errorqueue(self, error_msg):
        hostedTQ = HostedTaskQueue()
        if type(self.m_tags)!=list:
            logger.error('task tags is not a list:[%s]' % self.m_tags)
            raise Exception('tags type error in move_task_to_errorqueue')
        if TASK_STATUS_DICT['normal'] in self.m_tags:
            self.m_tags.remove(TASK_STATUS_DICT['normal'])
        if TASK_STATUS_DICT['retry'] in self.m_tags:
            self.m_tags.remove(TASK_STATUS_DICT['retry'])
        self.m_tags.append(TASK_STATUS_DICT['error'])

        tag_error = 'error_msg_base64=%s' % base64.encodestring(error_msg).replace('\n', '')
        self.m_tags.append(tag_error)
        try:
            hostedTQ.do_add(tqname=self.m_error_qname, namespace='mobile', account=int(self.m_account), version=1, payload=self.m_payload_base64, tags=self.m_tags, priority = self.m_priority)
        except MDMiHttpError, e:
            logger.debug('add error task failed:%s, will try to create error queue' % repr(e))
            error_qname_list = [
            {'name' : 'enrollmentError', 'settings' : {"description" : "Enrollment Decision Error task queue", "max_leases" : "30", "max_age" : "0"}}
            ]
            tqo = TaskQueueUtils(error_qname_list)
            tqo.init_task_queue()
            del tqo

            hostedTQ.do_add(tqname=self.m_error_qname, namespace='mobile', account=int(self.m_account), version=1, payload=self.m_payload_base64, tags=self.m_tags, priority = self.m_priority)
开发者ID:lls3018,项目名称:mdmi,代码行数:25,代码来源:taskutils.py


示例6: put_data

 def put_data(self, data, block=True, timeout=0):
     task_data = {}
     
     data = json.loads(data)
     if data['sync_type'] == 'metanate':
         key = ':'.join(['metanate', str(data['account']), data['trans_type'], data['sync_source']])
         task_data['key'] = key
         task_data['value'] = data
     elif data['sync_type'] == 'hybrid':
         key = ':'.join([data['sync_type'], str(data['account'])])
         task_data['key'] = key
         task_data['value'] = data
         
     while not self.__stop_event.is_set():
         try:
             self.__queue.put(task_data, block, timeout)
             logger.debug('put task data (%s, %s) successfully' % (key, data))
             break
         except Full:
             logger.debug('task cache size reachs max size')
             self.full_event.clear()
             self.full_event.wait()
         except Exception, e:
             logger.error('put task data into cache error %s' % repr(e))
             break
开发者ID:lls3018,项目名称:mdmi,代码行数:25,代码来源:task_cache.py


示例7: setup_table

    def setup_table(self, num):
        table = 'test_%s' % num
        self.cursor.execute('SHOW TABLES LIKE %s', [table])
        if self.cursor.fetchone():
            # Table already exists.
            return table

        logger.debug('Creating table "%s"' % table)

        _dir = dirname(__file__) or '.'
        with open(_dir + '/mysql_mid_table.sql', 'rb') as f:
            sql = f.read() % num
        self.cursor.execute(sql.strip(' ;\r\n'))

        delta = timedelta(seconds=self.CREATED_INTERVAL)
        start_dt = datetime.now() - delta * num
        for chunk in xrange(int(ceil(float(num) / self.CHUNK_SIZE))):
            values = list(chain(*[[
                MID_RECORD['name'] % (i + chunk * self.CHUNK_SIZE),
                MID_RECORD['data'],
                start_dt + delta * i,
            ] for i in xrange(self.CHUNK_SIZE)]))
            sql = (
                'INSERT INTO `%s` (`name`, `data`, `created`) VALUES ' % table
            ) + ('(%s, %s, %s), ' * self.CHUNK_SIZE)[:-2]
            self.cursor.execute('BEGIN')
            self.cursor.execute(sql, values)
            self.cursor.execute('COMMIT')
#             logger.debug(
#                 'Inserted chunk #%s with %s middle sized records',
#                 chunk + 1, self.CHUNK_SIZE
#             )
        logger.debug('Created with %s records' % num)
        return table
开发者ID:wreckah,项目名称:storage-perf,代码行数:34,代码来源:test_mysql.py


示例8: _get

	def _get(self, method, args):
		"""
			private helper to perform an api call
		"""
		url = self.API_BASE % (self.api_key, method, "/".join(args))
		logger.debug("fetching url '%s'" % url)
		return self._get_url(url)
开发者ID:ddierickx,项目名称:subr,代码行数:7,代码来源:providers.py


示例9: run

    def run(self):
        # read keys from files at first
        if self.m_enable_init:
            logger.info('Creator %d running, doing init!' % os.getpid())
            keys_list = self._init_keys_list()
            for item in keys_list:
                if not self.m_keylist_queue.full():
                    self._put(item)

        else:
            # waiting for init finished
            logger.debug('Creator %d running, waiting init done!' % os.getpid())
            while not self.m_ready_evt.is_set():
                if self._idle(1):
                    return
        logger.info('Creator %d init done!' % os.getpid())

        self._generate_keys_handle()

        # clean multiprocess queue
        self.m_keylist_queue.close()
        while not self.m_keylist_queue.empty():
            self.m_keylist_queue.get(1)

        logger.info('key pool creator(%d) exits' % os.getpid())
        return
        pass
开发者ID:lls3018,项目名称:mdmi,代码行数:27,代码来源:key_creator.py


示例10: do_bulk_op

    def do_bulk_op(self, content):
        '''
        Bulk add or/and update device information into RS

        Params:
            content:    data in a specific format, generated by format_bulk_data

        Return:
            instance object of class RestResult;
            exception message
        '''
        if isinstance(content, list):
            data = json.dumps(content)
        elif isinstance(attributes, basestring):
            data = content
        else:
            raise Exception('Invalid content!')

        resource = BULK_OP_URL % self.m_ver

        wrest = HostedAccess()
        logger.debug('bulk operation info - resource:%s, data:%s' % (resource, data))
        retval = wrest.do_access(resource, 'POST', data=data, headers=None)
        del wrest
        return retval
开发者ID:lls3018,项目名称:mdmi,代码行数:25,代码来源:hosted_device.py


示例11: list_sdk_versions

def list_sdk_versions(args):
    logger.debug(' * Retreiving list of App Engine SDK versions')
    versions = sdk.get_versions()
    for version in sdk.get_versions():
        print '{0}.{1}.{2}'.format(*version)

    sys.exit(0)
开发者ID:llinder,项目名称:gaeenv,代码行数:7,代码来源:main.py


示例12: do_insert

    def do_insert(self, devinfo=None):
        '''
        Insert one new device information to RS

        Params:
            devinfo: Detail information of the device.

        Return:
            Instance object of class RestResult;
            Exception message
        '''
        if not self.m_udid:
            raise Exception('Require device UDID!')
        resource = DEVRES_TEMPLATE_STR % (self.m_ver, self.m_udid)
        if isinstance(devinfo, dict):
            temp = devinfo
        elif isinstance(devinfo, basestring):
            temp = json.loads(devinfo)
        else:
            raise Exception('Invalid input!')

        temp = {'attributes':temp}
        data = json.dumps(temp)

        wrest = HostedAccess()
        logger.debug('Insert new device info - resource:%s, data:%s' % (resource, data))
        retval = wrest.do_access(resource, 'PUT', data=data, headers=None)
        del wrest
        return retval
开发者ID:lls3018,项目名称:mdmi,代码行数:29,代码来源:hosted_device.py


示例13: signal_handler

def signal_handler(signum, frame):
    logger.debug('Catched interrupt signal: %d in main process', signum)
    if signum == signal.SIGHUP:
        reload_config()
        g_service_status.reload_status()
    else:
        stop_children()
开发者ID:lls3018,项目名称:mdmi,代码行数:7,代码来源:task_service.py


示例14: do_update

    def do_update(self, tqname=None, namespace='mobile', account=1, version=1, taskname=0, payload=None, tags=None, priority='low', enqueuetime=''):
        '''
        Modify seciton value of one task.

        Params:
            tqname: Name of task queue.
            namespace: Namespace of the task queue.
            account: Account ID.
            version: Version of the resource, default value 1.
            taskname: Name of the specific task.
            payload: Base64 encode string.
            tags: Tags in the task.
            priority: Priority of the task.
            enqueuetime: Last modify time.

        Return:
            Instance object of class RestResult;
            Exception message
        '''
        assert(tqname)
        assert(payload and tags)
        resource = TQRES_TEMPLATE_STR % (version, account, namespace, tqname)
        temp = 'task-%s' % taskname
        resource = '/'.join([resource, temp])
        data = json.dumps({'payload_base64' : payload, 'tags' : tags, 'priority' : priority}, encoding="utf-8")
        header = self.m_wrest.generate_default_header()
        header.update({'If-Unmodified-Since' : enqueuetime})
        logger.debug('Update task - resource:%s, header:%s, data:%s' % (resource, header, data))
        return self.m_wrest.do_access(resource, 'PUT', data=data, headers=header)
开发者ID:lls3018,项目名称:mdmi,代码行数:29,代码来源:hosted_taskqueue.py


示例15: resolve

def resolve(address, uuid, adapter=None, bus=dbus.SystemBus()):
	try:
	    adapter.CreateDevice(address)
	    logger.debug("Device created: %s" % address)
	except:
	    logger.debug("Device all ready known: %s" % address)
	    
	path = adapter.FindDevice(address)
	
	device = dbus.Interface(bus.get_object("org.bluez", path),
							"org.bluez.Device")
	properties = device.GetProperties()
	
	if uuid in properties['UUIDs']:
	    services = device.DiscoverServices(uuid);
		
	    for key in services.keys():
		root=etree.XML(str(services[key]))
		res=CHANNEL_XPATH(root)
		if len(res)>0:
		    return int(res[0], 16)
	
	# lets check if the service is there now
	#adapter.RemoveDevice(path)
	
	raise Exception("UUID not found")
开发者ID:Nyophyte,项目名称:proximitymarketing,代码行数:26,代码来源:sdp.py


示例16: do_lease

    def do_lease(self, tqname=None, namespace='mobile', account=1, version=1, tasknum=0, tags=None, leasesec=10):
        '''
        Acquire a lease on the topmost {numTask} unowned tasks in the specified queue.

        Params:
            tqname: Name of task queue.
            namespace: Namespace of the task queue.
            account: Account ID.
            version: Version of the resource, default value 1.
            tasknum: Number of the tasks that expected.
            tags: Search conditions.

        Return:
            Instance object of class RestResult;
            Exception message
        '''
        assert(tqname)
        resource = TQRES_TEMPLATE_STR % (version, account, namespace, tqname)
        resource = '/'.join([resource, 'lease?numTasks=%s'])
        resource = resource % tasknum
        resource = '&'.join([resource, 'leaseSecs=%s'])
        resource = resource % leasesec
        if tags:
            data = json.dumps({'tags' : tags}, encoding="utf-8")
        else:
            data = tags
        logger.debug('Lease tasks - resource:%s, data:%s' % (resource, data))
        return self.m_wrest.do_access(resource, 'POST', data=data, headers=None)
开发者ID:lls3018,项目名称:mdmi,代码行数:28,代码来源:hosted_taskqueue.py


示例17: do_get_task_total

    def do_get_task_total(self, tqname=None, namespace='mobile', account=1, version=1, tags=None):
        '''
        Get total number of the specific task queue.

        Params:
            tqname: Name of task queue.
            namespace: Namespace of the task queue.
            account: Account ID.
            version: Version of the resource, default value 1.
            tags: Search conditions.

        Return:
            Total number of tasks on this taskqueue
            Exception message
        '''
        assert(tqname)
        resource = TQRES_TEMPLATE_STR % (version, account, namespace, tqname)
        resource = '/'.join([resource, 'stats'])
        if tags:
            data = json.dumps({'tags' : tags}, encoding="utf-8")
        else:
            data = tags
        logger.debug('Get total tasks number - resource:%s, data:%s' % (resource, data))
        result = self.m_wrest.do_access(resource, 'POST', data=data, headers=None)
        if result.code >= 200 and result.code < 300:
            logger.debug('Get Task Queue stats success!')
            try: #parse stat data
                tqs = json.loads(result.content)
                total_tasks = tqs.get('total_tasks')
                return total_tasks
            except Exception, e:
                logger.error('Get Task Queue stats Failed! %s' % repr(e))
开发者ID:lls3018,项目名称:mdmi,代码行数:32,代码来源:hosted_taskqueue.py


示例18: do_get

    def do_get(self, **conditions):
        '''
        Get one device information from RS

        Params:
            conditions: The conditions for device selecting.

        Return:
            One dict with device information.
            Exception message
        '''
        if self.m_udid:  # search by udid
            resource = DEVRES_TEMPLATE_STR % (self.m_ver, self.m_udid)
            method = 'GET'
            post_data = None
        else:  # without udid
            if conditions:
                resource = DEVSEARCH_TEMPLATE_STR % self.m_ver
                method = 'POST'
                post_data = '{"base":"ou=devices", "filter":"(&(objectClass=mobileDevice)'
                for cond in conditions:
                    temp_str = '(%s=%s)' % (str(cond), str(conditions[cond]))
                    post_data = post_data + temp_str
                post_data = ''.join([post_data,')"}'])
            else:
                raise Exception('Require device UDID or conditions for searching!')
        logger.debug('Get one device info - resource:%s' % (resource))
        wrest = HostedAccess()
        devinfo = wrest.do_access(resource, method, data=post_data, headers=None)
        del wrest
        return devinfo
开发者ID:lls3018,项目名称:mdmi,代码行数:31,代码来源:hosted_device.py


示例19: do_get_many

    def do_get_many(self, idx, max, sortby, **conditions):
        '''
        Get devices' information from RS

        Params:
            idx: Page index number. (0 ~ )
            max: Page size.
            sortby: Sort condition string.
            conditions: The conditions for device selecting.

        Return:
            One dict with devices information.
            Exception message
        '''
        offset_val = idx * max + 1
        after_val = max - 1
        vlv_str = '{"sort":["%s"],"vlv":{"before":0,"after":%d,"offset":%d},' % (sortby, after_val, offset_val)
        resource = DEVSEARCH_TEMPLATE_STR % self.m_ver
        method = 'POST'
        post_data = ''.join([vlv_str, '"base":"ou=devices", "filter":"(&(objectClass=mobileDevice)'])
        if conditions:
            for k,v in conditions.iteritems():
                cond_str = '(%s=%s)' % (k, str(v))
                post_data = ''.join([post_data, cond_str])
        post_data = ''.join([post_data, ')"}'])
        logger.debug('Get %d devices info - resource:%s, data:%s' % (max, resource, repr(post_data)))
        wrest = HostedAccess()
        devinfo = wrest.do_access(resource, method, data=post_data, headers=None)
        del wrest
        return devinfo
开发者ID:lls3018,项目名称:mdmi,代码行数:30,代码来源:hosted_device.py


示例20: download

def download(version=None):
	"""
    Download App Engine SDK
    """
	if not version:
		version = get_latest_version()
	if type(version) is str:
		version = tuple(version.split('.'))

	response = requests.get('https://storage.googleapis.com/appengine-sdks')
	response.raise_for_status()
	tree = ET.fromstring(response.text)

	path = None
	for key in tree.iter('{http://doc.s3.amazonaws.com/2006-03-01}Key'):
		match = re.match('^.*google_appengine_{0}.{1}.{2}\.zip$'.format(*version), key.text)
		if match:
			path = key.text
			break

	url = 'https://storage.googleapis.com/appengine-sdks/{path}'.format(**locals())

	logger.debug(' * Starting SDK download for version {0}.{1}.{2}'.format(*version))
	response = requests.get(url)
	response.raise_for_status()

	temp_zip = os.path.join(gettempdir(), 'google_appengine_{0}.{1}.{2}.zip'.format(*version))
	writefile(temp_zip, response.content, encode=None)
	return temp_zip
开发者ID:llinder,项目名称:gaeenv,代码行数:29,代码来源:sdk.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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