當前位置: 首頁>>代碼示例>>Python>>正文


Python Logger.debug方法代碼示例

本文整理匯總了Python中process.logging.Logger.debug方法的典型用法代碼示例。如果您正苦於以下問題:Python Logger.debug方法的具體用法?Python Logger.debug怎麽用?Python Logger.debug使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在process.logging.Logger的用法示例。


在下文中一共展示了Logger.debug方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: execute

# 需要導入模塊: from process.logging import Logger [as 別名]
# 或者: from process.logging.Logger import debug [as 別名]
    def execute(self, sql, params=None, timeout = 0):
        cursor = self.db_conn.cursor(cursorclass=Dbi.cursors.DictCursor)
        deathClock = None

        if self.debug:
            if params:
                log.debug(str(sql) + " % " + repr(params))
            else:
                log.debug(str(sql))

        if timeout > 0:
            deathClock = threading.Timer(timeout, self.kill_connection)
            deathClock.start()

        try:
            if params:
                cursor.execute(sql, params)
            elif hasattr(sql, 'uninterpolated_sql') and sql.params:
                cursor.execute(sql.uninterpolated_sql(), sql.params)
            else:
                cursor.execute(str(sql))
            #for row in cursor.fetchall():
            #	yield row
            out = cursor.fetchall()
            cursor.close()
            return out
        finally:
            if deathClock is not None:
                deathClock.cancel()
開發者ID:mikebirduk,項目名稱:wikimedia-fundraising-tools,代碼行數:31,代碼來源:db.py

示例2: is_fr_test

# 需要導入模塊: from process.logging import Logger [as 別名]
# 或者: from process.logging.Logger import debug [as 別名]
def is_fr_test(test):
    if test.label and test.banners and test.campaign:
        is_chapter = re.search(config.fr_chapter_test, test.banners[0])
        if is_chapter:
            log.debug("Determined test {title} belongs to a chapter".format(title=test.label))
        else:
            log.debug("Determined test {title} belongs to Fundraising".format(title=test.label))
        return not is_chapter

    log.warn("missing data for test {title}".format(title=test.label))
開發者ID:mikebirduk,項目名稱:wikimedia-fundraising-tools,代碼行數:12,代碼來源:spec.py

示例3: execute

# 需要導入模塊: from process.logging import Logger [as 別名]
# 或者: from process.logging.Logger import debug [as 別名]
    def execute(self, sql, params=None):
        cursor = self.db_conn.cursor(cursorclass=Dbi.cursors.DictCursor)

        if self.debug:
            if params:
                log.debug(str(sql) + " % " + repr(params))
            else:
                log.debug(str(sql))

        if params:
            cursor.execute(sql, params)
        elif hasattr(sql, 'uninterpolated_sql') and sql.params:
            cursor.execute(sql.uninterpolated_sql(), sql.params)
        else:
            cursor.execute(str(sql))
        #for row in cursor.fetchall():
        #	yield row
        out = cursor.fetchall()
        cursor.close()
        return out
開發者ID:adamwight,項目名稱:wikimedia-fundraising-tools,代碼行數:22,代碼來源:db.py

示例4: update_gdoc_results

# 需要導入模塊: from process.logging import Logger [as 別名]
# 或者: from process.logging.Logger import debug [as 別名]
def update_gdoc_results(doc=None, results=[]):
    log.info("Updating results in {url}".format(url=doc))
    doc = Spreadsheet(doc=doc)
    existing = list(doc.get_all_rows())

    def find_matching_cases(criteria):
        matching = []

        def fuzzy_compare_row(row, criteria):
            if not row:
                return False
            if criteria['banner'] == row['banner'] and criteria['campaign'] == row['campaign'] and criteria['start'] == row['start']:
                return True

        for n, row in enumerate(existing, 1):
            if fuzzy_compare_row(row, criteria):
                matching.append(n)

        return matching

    for result in results:
        if not result:
            continue

        matching = find_matching_cases(result['criteria'])

        props = {}
        props.update(result['results'])
        props.update(result['criteria'])

        if len(matching) == 0:
            doc.append_row(props)
        else:
            if len(matching) > 1:
                log.warn("more than one result row {match} matches criteria: {criteria}".format(match=matching, criteria=result['criteria']))
            index = matching[-1]
            log.debug("updating row {rownum} with {banner}".format(rownum=index, banner=result['criteria']['banner']))
            doc.update_row(props, index=index)
開發者ID:mikebirduk,項目名稱:wikimedia-fundraising-tools,代碼行數:40,代碼來源:results_gdoc.py


注:本文中的process.logging.Logger.debug方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。