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


Python logger.info函数代码示例

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


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

示例1: message

    def message(self, msg):
        if msg['type'] not in ('chat', 'normal'):
            logger.debug('Strange message type: %(type)s' % msg)
            return
        #logger.info('Message from %(from)s: %(body)s' % msg)
        
        msg_text = msg['body'].strip()
        # msg['from'] is a JID object
        # http://sleekxmpp.com/api/xmlstream/jid.html
        from_user = msg['from'].bare 
        logger.info('FROM:' + from_user)
        logger.info('MSG:' + msg_text)

        try:
            if (from_user in settings.accept_command_from) and msg_text.startswith("$"):
                resp = commands.execute(msg_text[1:])
                msg.reply('\n'+resp).send()
            else:
                msg.reply(msg_text).send()
                #self.send_message(  mto=msg['from'],
                #                    mtype='chat',
                #                    mbody=msg_text,
                #                    mhtml='''<a href="http://www.google.co.jp">%s</a>'''% (msg_text))
        except:
            exc = traceback.format_exc()
            msg.reply(exc).send()
开发者ID:jtdeng,项目名称:transmission-bot,代码行数:26,代码来源:xmppbot.py

示例2: discover_indexes

    def discover_indexes(self):
	self.self_cursor.execute("SELECT obj_oid,idx_name,id FROM index_name WHERE tn_id={0} AND alive".format(self.id))
	local_idxs=self.self_cursor.fetchall()
	try:
	    self.prod_cursor.execute("""SELECT i.indexrelid,c.relname,i.indisunique,i.indisprimary
FROM pg_index i
JOIN pg_class c ON i.indexrelid=c.oid
WHERE i.indrelid={0}""".format(self.db_fields['obj_oid']))
	except Exception as e:
	    logger.error("Cannot execute index discovery query: {0}".format(e.pgerror))
	    return
	prod_idxs=self.prod_cursor.fetchall()
	for l_idx in local_idxs:
	    for p_idx in prod_idxs:
		if l_idx[0]==p_idx[0] and l_idx[1]==p_idx[1]:
		    break
	    else:
		logger.info("Retired index {0} in table {1}".format(l_idx[1],self.db_fields['tbl_name']))
		old_idx=IndexName(l_idx[2])
		old_idx.retire()
	for p_idx in prod_idxs:
	    for l_idx in local_idxs:
		if l_idx[0]==p_idx[0] and l_idx[1]==p_idx[1]:
		    break
	    else:
		logger.info("Create new index {0} in table {1}".format(p_idx[1],self.db_fields['tbl_name']))
		new_index=IndexName()
		new_index.set_fields(tn_id=self.id,obj_oid=p_idx[0],idx_name=p_idx[1],is_unique=p_idx[2],is_primary=p_idx[3])
		new_index.create()
		new_index.truncate()
开发者ID:arsen-movsesyan,项目名称:pg-Mon,代码行数:30,代码来源:objects.py

示例3: get

    def get(self):
        uid = self.current_user
        type_ = self.get_argument('type', None)
        if not type_:
            self.set_status(400)
            result = dict(code=40011, msg=u'缺少type参数')
            return self.jsonify(result)

        keep_info = self.keep_map(type_)

        key = "uid:{}:keep:{}".format(uid, type_)
        times = rdb.incr(key)
        if times == 1:
            rdb.expire(key, get_to_tomorrow())
        else:
            logger.warning('have try times {}'.format(times))
            result = dict(code=40010, msg=u'每天只能{}一次哦!'.format(keep_info['name']))
            return self.jsonify(result)

        try:
            row = Pet.keep(uid=uid, score=keep_info['score'])
            logger.info('keep pet {}'.format(row))
        except Exception, e:
            self.set_status(500)
            logger.error('keep pet error {}'.format(e))
            result = dict(code=40012, msg=u'更新服务器错误, 请稍后重试!')
            return self.jsonify(result)
开发者ID:simonzhangfang,项目名称:tongdao,代码行数:27,代码来源:home.py

示例4: set_ds_info

 def set_ds_info():
     """ Setting information about available space for a given disk."""
     msg = "[Disk Space Available on %s] : %d percent free space - it is %s." % (
         self.__disk_name, 
         self.__percent_available,
         h.get_human_val_of_disk_space( self.__available) )
     logger.info(msg)
开发者ID:lkolacz,项目名称:ewsods,代码行数:7,代码来源:ewsods.py

示例5: write_tree

    def write_tree(self, dest_path):
        ''' Creates directory tree from root node.
        write_tree(dest_path)
        Will delete tree if exists.
        '''

        self.delete_if_dir_exists(dest_path)
        dest_path, name = os.path.split(dest_path)
        self.root.name = name

        def make(dest_path, node):
            dest_path = os.path.join(dest_path, node.name)
            if node.type == PATH_TYPES.FOLDER:
                try:
                    os.makedirs(dest_path)
                except:
                    raise
            elif node.type == PATH_TYPES.FILE:
                with open(dest_path, 'a') as f:
                    pass

            for child in node.children:
                make(dest_path, child)
        make(dest_path, self.root)
        logger.info('tree.write_tree() completed [{}]'.format(dest_path))
开发者ID:gtalarico,项目名称:foldify,代码行数:25,代码来源:tree.py

示例6: discover_tables

    def discover_tables(self):
	self.self_cursor.execute("SELECT obj_oid,tbl_name,id FROM table_name WHERE {0}={1} AND alive".format(self.sub_fk,self.id))
	local_tbls=self.self_cursor.fetchall()
	try:
	    self.prod_cursor.execute("""SELECT r.oid,r.relname,
CASE WHEN h.inhrelid IS NULL THEN 'f'::boolean ELSE 't'::boolean END AS has_parent
FROM pg_class r
LEFT JOIN pg_inherits h ON r.oid=h.inhrelid
WHERE r.relkind='r'
AND r.relnamespace=(SELECT oid FROM pg_namespace WHERE nspname='public')""")
	except Exception as e:
	    logger.error("Cannot execute tables discovery query: {0}".format(e.pgerror))
	    return
	prod_tbls=self.prod_cursor.fetchall()
	for l_table in local_tbls:
	    for p_table in prod_tbls:
		if l_table[0]==p_table[0] and l_table[1]==p_table[1]:
		    break
	    else:
		logger.info("Retired table {0} in schema {1}".format(l_table[1],self.db_fields['sch_name']))
		old_table=TableName(l_table[2])
#		old_table.populate()
		old_table.retire()
	for p_table in  prod_tbls:
	    for l_table in local_tbls:
		if p_table[0]==l_table[0] and p_table[1]==l_table[1]:
		    break
	    else:
		logger.info("Created new table: {0} in schema {1}".format(p_table[1],self.db_fields['sch_name']))
		new_table=TableName()
		new_table.set_fields(sn_id=self.id,tbl_name=p_table[1],obj_oid=p_table[0],has_parent=p_table[2])
		new_table.create()
		new_table.truncate()
开发者ID:arsen-movsesyan,项目名称:pg-Mon,代码行数:33,代码来源:objects.py

示例7: get_check_create_test_run

    def get_check_create_test_run(self, plan, cases):
        plan = self.project.plans.get(plan.id)
        suite_cases = self.suite.cases()
        run_name = self.get_run_name()
        runs = plan.runs.find_all(name=run_name)
        run = self.check_need_create_run(plan,
                                         runs,
                                         suite_cases)

        if run is None:
            logger.info('Run not found in plan "{}", create: "{}"'.format(
                plan.name, run_name))

            # Create new test run with cases from test suite
            suite_cases = self.get_suite_cases()

            if not suite_cases:
                logger.error('Empty test cases set.')
                return None

            # suite_cases = self.suite.cases.find(type_id=type_ids[0])
            run = Run(name=run_name,
                      description=self.run_description,
                      suite_id=self.suite.id,
                      milestone_id=self.milestone.id,
                      config_ids=[],
                      case_ids=[x.id for x in suite_cases]
                      )
            plan.add_run(run)
            logger.debug('Run created "{}"'.format(run_name))
        return run
开发者ID:ehles,项目名称:trep,代码行数:31,代码来源:reporter.py

示例8: exec_dcfg

	def exec_dcfg(self):

		# first exec support script to install system tables.
		try:
			logger.info("============MYSQL DEFAULT CONFIG===========")
			logger.info("install system db.")
			os.chdir(mysql_home)
			exec_command('./scripts/mysql_install_db --user=mysql')

			logger.info("copy boot script to correct directory.")
			exec_command('cp ' + mysql_boot_script + ' /etc/init.d/')

			# sed config
			exec_command('sed -i -e "46s/basedir=/basedir=\/opt\/magima\/mysql/g" /etc/init.d/mysql.server')

			exec_command('sed -i -e "47s/datadir=/datadir=\/opt\/magima\/mysql\/data/g" /etc/init.d/mysql.server')

			exec_command("/etc/init.d/mysql.server start")
			exec_command("/etc/init.d/mysql.server status")
			exec_command("/etc/init.d/mysql.server stop")
			logger.info("==============TOMCAT DEFAULT CONFIG==============")
			logger.info("copy tomcat bootscript to /etc/init.d/")
			exec_command("cp " + tomcat_bootstrap + " /etc/init.d/tomcat6")
			exec_command("sudo /etc/init.d/tomcat6 start")
			exec_command("sudo /etc/init.d/tomcat6 status")
			exec_command("sudo /etc/init.d/tomcat6 stop")

		except OSError , oserr:
			logger.error("os error: %s " % str(oserr))
			sys.exit(1)
开发者ID:jamesduan,项目名称:common_tools,代码行数:30,代码来源:dcfg.py

示例9: wrapper

    def wrapper(self, *args, **kwargs):
        sign = self.get_argument('sign', None)
        if not sign:
            raise ValueError(404)
        appid = self.get_argument('appid', None)
        if not appid:
            raise ValueError(405)

        model_base = BaseModel()
        arguments = sorted(self.request.arguments.iteritems(), key=lambda x: x[0])
        result_string = ''.join([k + v[0] for k, v in arguments if k != 'sign'])
        appsecret = model_base.getAppSercet(appid)
        if not appsecret:
            raise ValueError(405)

        def default(*args):
            raise ValueError(403)

        def md5Method(result_string, appsecret):
            return hashlib.md5(appsecret + result_string + appsecret).hexdigest()

        switch = {
            'md5': md5Method,
        }

        mysign = switch.get(self.get_argument('sign_method', None), default)(result_string, appsecret)
        logger.info("sign:%s" % mysign)
        if mysign != sign:
            raise ValueError(402)
        return func(*args, **kwargs)
开发者ID:aosen,项目名称:apistore,代码行数:30,代码来源:utils.py

示例10: connect

	def connect(self):
		while not self.conn:
			self.conn = self.__connect()
			if not self.conn:
				interval = random.randint(0, s.get('reconnect_interval', MAX_INTERVAL))
				logger.info('connection will be established in %ss' % interval)
				time.sleep(interval)
开发者ID:dyan0123,项目名称:Utils,代码行数:7,代码来源:database.py

示例11: read

	def read(self, filename, quiet=False):
		self.filename = filename
		if not quiet:
			try:
				logger.info('processing file: %s' % filename.decode(settings.DECODING).encode(settings.ENCODING))
			except UnicodeDecodeError, e:
				logger.info('processing file ...')
开发者ID:dyan0123,项目名称:Utils,代码行数:7,代码来源:parse_blocks.py

示例12: handle_blocked

    def handle_blocked(self, test, result):
        if result['custom_launchpad_bug']:
            return False
        m = re.search(r'Blocked by "(\S+)" test.', result['comment'])
        if m:
            blocked_test_group = m.group(1)
        else:
            logger.debug('Blocked result #{0} for test {1} does '
                         'not have upstream test name in its '
                         'comments!'.format(result['id'],
                                            test['custom_test_group']))
            return False

        if not result['version']:
            logger.debug('Blocked result #{0} for test {1} does '
                         'not have version, can\'t find upstream '
                         'test case!'.format(result['id'],
                                             test['custom_test_group']))
            return False

        bug_link = None
        blocked_test = self.get_test_by_group(blocked_test_group,
                                              result['version'])
        if not blocked_test:
            return False
        logger.debug('Test {0} was blocked by failed test {1}'.format(
            test['custom_test_group'], blocked_test_group))

        blocked_results = self.project.get_results_for_test(
            blocked_test['id'])

        # Since we manually add results to failed tests with statuses
        # ProdFailed, TestFailed, etc. and attach bugs links to them,
        # we could skip original version copying. So look for test
        # results with target version, but allow to copy links to bugs
        # from other results of the same test (newer are checked first)
        if not any(br['version'] == result['version'] and
                   br['status_id'] in self.failed_statuses
                   for br in blocked_results):
            logger.debug('Did not find result for test {0} with version '
                         '{1}!'.format(blocked_test_group, result['version']))
            return False

        for blocked_result in sorted(blocked_results,
                                     key=lambda x: x['id'],
                                     reverse=True):
            if blocked_result['status_id'] not in self.failed_statuses:
                continue

            if blocked_result['custom_launchpad_bug']:
                bug_link = blocked_result['custom_launchpad_bug']
                break

        if bug_link is not None:
            result['custom_launchpad_bug'] = bug_link
            self.project.add_raw_results_for_test(test['id'], result)
            logger.info('Added bug {0} to blocked result of {1} test.'.format(
                bug_link, test['custom_test_group']))
            return bug_link
        return False
开发者ID:SergK,项目名称:fuel-qa,代码行数:60,代码来源:generate_statistics.py

示例13: post

    def post(self, aid):

        # 图片上传
        if self.request.files:
            files_body = self.request.files['file']
            file_ = files_body[0]
            # 文件扩展名处理
            file_extension = parse_file_extension(file_)

            # 新建上传目录
            base_dir = config.UPLOADS_DIR['csv_dir']
            if not os.path.exists(base_dir):
                os.makedirs(base_dir)
            logger.info('new dir ---------- {}'.format(base_dir))

            new_file_name = '{}{}'.format(time.time(), file_extension)
            new_file = os.path.join(base_dir, new_file_name)

            # 备份以前上传的文件
            if os.path.isfile(new_file):
                bak_file_name = '{}bak{}'.format(time.time(), file_extension)
                bak_file = os.path.join(base_dir, bak_file_name)
                os.rename(new_file, bak_file)

            # 写入文件
            with open(new_file, 'w') as w:
                w.write(file_['body'])

            key = 'aid:{}'.format(aid)
            with open(new_file, 'r') as f:
                for line in csv.reader(f):
                    row =  rdb.lpush(key, line[0])
                    logger.info('redis lpush key-- {} resp-- {}'.format(key, row))
        self.redirect('/admin/awards')
开发者ID:simonzhangfang,项目名称:tongdao,代码行数:34,代码来源:admin.py

示例14: get_current_user

 def get_current_user(self):
     super(BaseRequestHandler, self).get_current_user()
     user = self.session.get('user')
     logger.info('{}: Login user {}'.format(self.__class__.__name__, user))
     if not user:
         return None
     return user
开发者ID:agentwx,项目名称:thought,代码行数:7,代码来源:helper.py

示例15: r_file

def r_file(filename, mode=None, content="", action=""):

	is_exists_file = os.path.exists(filename)

	if action == "create":

		if is_exists_file:

			try:
				os.remove(filename)
				os.mknod(filename)
				logger.info("Create File Ok.")

				with open(filename , 'w+') as f:
					f.write(content)

			except OSError, e:
				logger.error("filename: %s " % (filename) + str(e) )
				sys.exit(1)
		else:

			try:
				os.mknod(filename)
				logger.info("Create File Ok.")

				with open(filename , 'w+') as f:
					f.write(content)

			except OSError, e:
				logger.error("filename: %s" % (filename) + str(e))
				sys.exit(1)
开发者ID:jamesduan,项目名称:common_tools,代码行数:31,代码来源:resource.py


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