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


Python Log.debug方法代码示例

本文整理汇总了Python中config.Log.debug方法的典型用法代码示例。如果您正苦于以下问题:Python Log.debug方法的具体用法?Python Log.debug怎么用?Python Log.debug使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在config.Log的用法示例。


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

示例1: recover

# 需要导入模块: from config import Log [as 别名]
# 或者: from config.Log import debug [as 别名]
    def recover(self):
        """
        @brief      Recover from snapshot data.
        @return     Bool: whether operation succeed.
        """
        cm = ConfigManager()
        [self.uuid, self.redirect_uri, self.uin,
        self.sid, self.skey, self.pass_ticket,
        self.synckey, device_id, self.last_login] = cm.get_wechat_config()

        if device_id:
            self.device_id = device_id

        self.base_request = {
            'Uin': int(self.uin),
            'Sid': self.sid,
            'Skey': self.skey,
            'DeviceID': self.device_id,
        }

        # set cookie
        Log.debug('set cookie')
        self.cookie = set_cookie(self.cookie_file)

        return True
开发者ID:CrackerCat,项目名称:WeixinBot,代码行数:27,代码来源:wechat.py

示例2: get

# 需要导入模块: from config import Log [as 别名]
# 或者: from config.Log import debug [as 别名]
def get(url, api=None):
    """
    @brief      http get request
    @param      url   String
    @param      api   wechat api
    @return     http response
    """
    Log.debug('GET -> ' + url)
    request = urllib2.Request(url=url)
    request.add_header(*Constant.HTTP_HEADER_CONNECTION)
    request.add_header(*Constant.HTTP_HEADER_REFERER)
    if api in ['webwxgetvoice', 'webwxgetvideo']:
        request.add_header(*Constant.HTTP_HEADER_RANGE)

    while True:
        try:
            response = urllib2.urlopen(request, timeout=30)
            data = response.read()
            response.close()
            if api == None:
                Log.debug(data)
            return data
        except (KeyboardInterrupt, SystemExit):
            raise
        except:
            Log.error(traceback.format_exc())

        time.sleep(1)
开发者ID:CrackerCat,项目名称:WeixinBot,代码行数:30,代码来源:utils.py

示例3: delete_table

# 需要导入模块: from config import Log [as 别名]
# 或者: from config.Log import debug [as 别名]
 def delete_table(self, table):
     """
     @brief      Delete a table in database
     @param      table  String
     """
     sql = "DROP TABLE if exists %s;" % table
     Log.debug('DB -> %s' % sql)
     self.execute(sql)
开发者ID:CrackerCat,项目名称:WeixinBot,代码行数:10,代码来源:sqlite_db.py

示例4: close

# 需要导入模块: from config import Log [as 别名]
# 或者: from config.Log import debug [as 别名]
    def close(self):
        """
        @brief      close connection to database
        """
        Log.debug('DB -> close')
        # 关闭数据库连接
        self.conn.close()

        
开发者ID:CrackerCat,项目名称:WeixinBot,代码行数:9,代码来源:mysql_db.py

示例5: insert

# 需要导入模块: from config import Log [as 别名]
# 或者: from config.Log import debug [as 别名]
 def insert(self, table, value):
     """
     @brief      Insert a row in table
     @param      table  String
     @param      value  Tuple
     """
     sql = ("INSERT INTO %s VALUES (" + ",".join(['?'] * len(value)) + ");") % table
     Log.debug('DB -> %s' % sql)
     self.execute(sql, value)
开发者ID:CrackerCat,项目名称:WeixinBot,代码行数:11,代码来源:sqlite_db.py

示例6: create_table

# 需要导入模块: from config import Log [as 别名]
# 或者: from config.Log import debug [as 别名]
 def create_table(self, table, cols):
     """
     @brief      Creates a table in database
     @param      table  String
     @param      cols   String, the cols in table
     """
     sql = "CREATE TABLE if not exists %s (%s);" % (table, cols)
     Log.debug('DB -> %s' % sql)
     self.execute(sql)
开发者ID:CrackerCat,项目名称:WeixinBot,代码行数:11,代码来源:sqlite_db.py

示例7: create_db

# 需要导入模块: from config import Log [as 别名]
# 或者: from config.Log import debug [as 别名]
 def create_db(self, db_name):
     """
     @brief      Creates a database
     @param      db_name  String
     """
     if self.conf['database'] not in self.show_database():
         sql = 'CREATE DATABASE IF NOT EXISTS %s CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci' % db_name
         Log.debug('DB -> %s' % sql)
         self.execute(sql)
开发者ID:CrackerCat,项目名称:WeixinBot,代码行数:11,代码来源:mysql_db.py

示例8: insert

# 需要导入模块: from config import Log [as 别名]
# 或者: from config.Log import debug [as 别名]
 def insert(self, table, value):
     """
     @brief      Insert a row in table
     @param      table  String
     @param      value  Tuple
     """
     col_name = self.table_cols[table][1:]
     sql = "INSERT INTO %s(%s) VALUES (%s)" % (table, str(','.join(col_name)), array_join(value, ','))
     Log.debug('DB -> %s' % sql)
     self.execute(sql)
开发者ID:CrackerCat,项目名称:WeixinBot,代码行数:12,代码来源:mysql_db.py

示例9: insertmany

# 需要导入模块: from config import Log [as 别名]
# 或者: from config.Log import debug [as 别名]
 def insertmany(self, table, values):
     """
     @brief      Insert many rows in table
     @param      table  String
     @param      values  Array of tuple
     """
     col_name = self.table_cols[table][1:]
     sql = 'INSERT INTO %s(%s) VALUES (%s)' % (table, ','.join(col_name), ','.join(['%s'] * len(values[0])))
     Log.debug('DB -> %s' % sql)
     self.execute(sql, values)
开发者ID:CrackerCat,项目名称:WeixinBot,代码行数:12,代码来源:mysql_db.py

示例10: delete

# 需要导入模块: from config import Log [as 别名]
# 或者: from config.Log import debug [as 别名]
 def delete(self, table, field='', condition=''):
     """
     @brief      execute sql commands, return result if it has
     @param      table  String
     @param      field  String
     @param      condition  String
     """
     sql = "DELETE FROM %s WHERE %s=%s" % (table, field, condition)
     Log.debug('DB -> %s' % sql)
     self.execute(sql)
开发者ID:CrackerCat,项目名称:WeixinBot,代码行数:12,代码来源:mysql_db.py

示例11: delete_table

# 需要导入模块: from config import Log [as 别名]
# 或者: from config.Log import debug [as 别名]
 def delete_table(self, table):
     """
     @brief      Delete a table in database
     @param      table  String
     """
     if table in self.table_cols:
         sql = "DROP TABLE IF EXISTS %s" % table
         Log.debug('DB -> %s' % sql)
         self.execute(sql)
         self.table_cols.pop(table)
开发者ID:CrackerCat,项目名称:WeixinBot,代码行数:12,代码来源:mysql_db.py

示例12: check_schedule_task

# 需要导入模块: from config import Log [as 别名]
# 或者: from config.Log import debug [as 别名]
 def check_schedule_task(self):
     # update group member list at 00:00 am every morning
     t = time.localtime()
     if t.tm_hour == 0 and t.tm_min <= 1:
         # update group member
         Log.debug('update group member list everyday')
         self.db.delete_table(Constant.TABLE_GROUP_LIST())
         self.db.delete_table(Constant.TABLE_GROUP_USER_LIST())
         self.db.create_table(Constant.TABLE_GROUP_LIST(), Constant.TABLE_GROUP_LIST_COL)
         self.db.create_table(Constant.TABLE_GROUP_USER_LIST(), Constant.TABLE_GROUP_USER_LIST_COL)
         self.wechat.fetch_group_contacts()
开发者ID:CrackerCat,项目名称:WeixinBot,代码行数:13,代码来源:wechat_msg_processor.py

示例13: str2qr_terminal

# 需要导入模块: from config import Log [as 别名]
# 或者: from config.Log import debug [as 别名]
def str2qr_terminal(text):
    """
    @brief      convert string to qrcode matrix and outprint
    @param      text   The string
    """
    Log.debug(text)
    qr = qrcode.QRCode()
    qr.border = 1
    qr.add_data(text)
    mat = qr.get_matrix()
    print_qr(mat)
开发者ID:CrackerCat,项目名称:WeixinBot,代码行数:13,代码来源:utils.py

示例14: create_table

# 需要导入模块: from config import Log [as 别名]
# 或者: from config.Log import debug [as 别名]
 def create_table(self, table, cols):
     """
     @brief      Creates a table in database
     @param      table  String
     @param      cols   String, the cols in table
     """
     if table not in self.table_cols:
         sql = 'CREATE TABLE IF NOT EXISTS %s(id int primary key auto_increment, %s) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci' % (table, cols)
         Log.debug('DB -> %s' % sql)
         self.execute(sql)
         self.table_cols[table] = ['id'] + [c.strip().split(' ')[0] for c in cols.split(',')]
开发者ID:CrackerCat,项目名称:WeixinBot,代码行数:13,代码来源:mysql_db.py

示例15: update

# 需要导入模块: from config import Log [as 别名]
# 或者: from config.Log import debug [as 别名]
    def update(self, table, dic, condition=''):
        k_arr = []
        v_arr = []
        for (k, v) in dic.items():
            k_arr.append('%s=?' % k)
            v_arr.append(v)

        sql = "UPDATE %s SET %s" % (table, ','.join(k_arr))
        if condition:
            sql += " WHERE %s" % condition

        Log.debug('DB -> %s' % sql)
        self.execute(sql, tuple(v_arr))
开发者ID:CrackerCat,项目名称:WeixinBot,代码行数:15,代码来源:sqlite_db.py


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