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


Python logger.debug方法代碼示例

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


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

示例1: getCachedFile

# 需要導入模塊: import logger [as 別名]
# 或者: from logger import debug [as 別名]
def getCachedFile(siteCachePath,cacheId):
    mascara = os.path.join(siteCachePath,cacheId[:2],cacheId[2:],"*.cache")
    logger.debug("[scrapertools.py] mascara="+mascara)
    import glob
    ficheros = glob.glob( mascara )
    logger.debug("[scrapertools.py] Hay %d ficheros con ese id" % len(ficheros))

    cachedFile = ""

    # Si hay más de uno, los borra (serán pruebas de programación) y descarga de nuevo
    if len(ficheros)>1:
        logger.debug("[scrapertools.py] Cache inválida")
        for fichero in ficheros:
            logger.debug("[scrapertools.py] Borrando "+fichero)
            os.remove(fichero)
        
        cachedFile = ""

    # Hay uno: fichero cacheado
    elif len(ficheros)==1:
        cachedFile = ficheros[0]

    return cachedFile 
開發者ID:tvalacarta,項目名稱:tvalacarta,代碼行數:25,代碼來源:scrapertools.py

示例2: role

# 需要導入模塊: import logger [as 別名]
# 或者: from logger import debug [as 別名]
def role():
    new_role = False
    try:
        logger.info('finding role')
        iam('get_role', RoleName='gimel')
    except ClientError:
        logger.info('role not found. creating')
        iam('create_role', RoleName='gimel',
            AssumeRolePolicyDocument=ASSUMED_ROLE_POLICY)
        new_role = True

    role_arn = iam('get_role', RoleName='gimel', query='Role.Arn')
    logger.debug('role_arn={}'.format(role_arn))

    logger.info('updating role policy')

    iam('put_role_policy', RoleName='gimel', PolicyName='gimel',
        PolicyDocument=POLICY)

    if new_role:
        from time import sleep
        logger.info('waiting for role policy propagation')
        sleep(5)

    return role_arn 
開發者ID:Alephbet,項目名稱:gimel,代碼行數:27,代碼來源:deploy.py

示例3: role

# 需要導入模塊: import logger [as 別名]
# 或者: from logger import debug [as 別名]
def role():
    new_role = False
    try:
        logger.info('finding role')
        iam('get_role', RoleName='cronyo')
    except ClientError:
        logger.info('role not found. creating')
        iam('create_role', RoleName='cronyo',
            AssumeRolePolicyDocument=ASSUMED_ROLE_POLICY)
        new_role = True

    role_arn = iam('get_role', RoleName='cronyo', query='Role.Arn')
    logger.debug('role_arn={}'.format(role_arn))

    logger.info('updating role policy')

    iam('put_role_policy', RoleName='cronyo', PolicyName='cronyo',
        PolicyDocument=POLICY)

    if new_role:
        from time import sleep
        logger.info('waiting for role policy propagation')
        sleep(5)

    return role_arn 
開發者ID:cronyo,項目名稱:cronyo,代碼行數:27,代碼來源:deploy.py

示例4: find_group_by_wechattype

# 需要導入模塊: import logger [as 別名]
# 或者: from logger import debug [as 別名]
def find_group_by_wechattype():
	#查詢wechat所屬組
	sql = "select DISTINCT(wechat_group) as wechat_group from biz_system_tree"
	logger.debug("sql:%s", sql)
	# conn = pymysql.connect(host="127.0.0.1",user="username",passwd="password",
	# 					  				   db="chatbot",
	# 					  				   charset="utf8")
	conn = __connection_pool.connection()
	cursor = conn.cursor()
	cursor.execute(sql)
	dutys = cursor.fetchall()

	wechat_groups  = []
	for d in dutys:
		wechat_groups.append(d['wechat_group'].decode('UTF-8'))

	cursor.close()
	conn.close()
	return wechat_groups 
開發者ID:newsettle,項目名稱:ns4_chatbot,代碼行數:21,代碼來源:db_helper.py

示例5: send

# 需要導入模塊: import logger [as 別名]
# 或者: from logger import debug [as 別名]
def send(apiUrl,data,method=None):
    logger.debug("調用內部係統[%s],data[%r]",apiUrl,data)
    try:
        data_json = json.dumps(data)
        headers = {'Content-Type': 'application/json'} # 設置數據為json格式,很重要
        request = urllib2.Request(url=apiUrl, headers=headers, data=data_json)
        if method is not None:
            request.get_method = method

        response = urllib2.urlopen(request)
        result = {'code':response.getcode(),'content':response.read()}
        logger.debug("調用[%s]返回結果:%r",apiUrl,result)
        return result
    except Exception as e:
        #traceback.print_stack()
        logger.exception(e,"調用內部係統[%s],data[%r],發生錯誤[%r]", apiUrl, data,e)
        return None 
開發者ID:newsettle,項目名稱:ns4_chatbot,代碼行數:19,代碼來源:web_client.py

示例6: setTakeSnapshotMessage

# 需要導入模塊: import logger [as 別名]
# 或者: from logger import debug [as 別名]
def setTakeSnapshotMessage(self, type_id, message, timeout = -1):
        data = str(type_id) + '\n' + message

        try:
            with open(self.config.takeSnapshotMessageFile(), 'wt') as f:
                f.write(data)
        except Exception as e:
            logger.debug('Failed to set takeSnapshot message to %s: %s'
                         %(self.config.takeSnapshotMessageFile(), str(e)),
                         self)

        if 1 == type_id:
            self.snapshotLog.append('[E] ' + message, 1)
        else:
            self.snapshotLog.append('[I] '  + message, 3)

        try:
            profile_id =self.config.currentProfile()
            profile_name = self.config.profileName(profile_id)
            self.config.PLUGIN_MANAGER.message(profile_id, profile_name, type_id, message, timeout)
        except Exception as e:
            logger.debug('Failed to send message to plugins: %s'
                         %str(e),
                         self) 
開發者ID:bit-team,項目名稱:backintime,代碼行數:26,代碼來源:snapshots.py

示例7: userName

# 需要導入模塊: import logger [as 別名]
# 或者: from logger import debug [as 別名]
def userName(self, uid):
        """
        Get the username for the given uid.
        uid->name will be cached to speed up subsequent requests.

        Args:
            uid (int):  User identifier (UID) to search for

        Returns:
            str:        name of the user with UID uid or '-' if not found
        """
        if uid in self.userCache:
            return self.userCache[uid]
        else:
            name = '-'
            try:
                name = pwd.getpwuid(uid).pw_name
            except Exception as e:
                logger.debug('Failed to get user name for UID %s: %s'
                             %(uid, str(e)),
                             self)

            self.userCache[uid] = name
            return name 
開發者ID:bit-team,項目名稱:backintime,代碼行數:26,代碼來源:snapshots.py

示例8: smartRemoveKeepAll

# 需要導入模塊: import logger [as 別名]
# 或者: from logger import debug [as 別名]
def smartRemoveKeepAll(self,
                           snapshots,
                           min_date,
                           max_date):
        """
        Return all snapshots between ``min_date`` and ``max_date``.

        Args:
            snapshots (list):           full list of :py:class:`SID` objects
            min_date (datetime.date):   minimum date for snapshots to keep
            max_date (datetime.date):   maximum date for snapshots to keep

        Returns:
            set:                        set of snapshots that should be keept
        """
        min_id = SID(min_date, self.config)
        max_id = SID(max_date, self.config)

        logger.debug("Keep all >= %s and < %s" %(min_id, max_id), self)

        return set([sid for sid in snapshots if sid >= min_id and sid < max_id]) 
開發者ID:bit-team,項目名稱:backintime,代碼行數:23,代碼來源:snapshots.py

示例9: statFreeSpaceLocal

# 需要導入模塊: import logger [as 別名]
# 或者: from logger import debug [as 別名]
def statFreeSpaceLocal(self, path):
        """
        Get free space on filsystem containing ``path`` in MiB using
        :py:func:`os.statvfs()`. Depending on remote SFTP server this might fail
        on sshfs mounted shares.

        Args:
            path (str): full path

        Returns:
            int         free space in MiB
        """
        try:
            info = os.statvfs(path)
            if info.f_blocks != info.f_bavail:
                return info.f_frsize * info.f_bavail // (1024 * 1024)
        except Exception as e:
            logger.debug('Failed to get free space for %s: %s'
                         %(path, str(e)),
                         self)
        logger.warning('Failed to stat snapshot path', self) 
開發者ID:bit-team,項目名稱:backintime,代碼行數:23,代碼來源:snapshots.py

示例10: flockExclusive

# 需要導入模塊: import logger [as 別名]
# 或者: from logger import debug [as 別名]
def flockExclusive(self):
        """
        Block :py:func:`backup` from other profiles or users
        and run them serialized
        """
        if self.config.globalFlock():
            logger.debug('Set flock %s' %self.GLOBAL_FLOCK, self)
            self.flock = open(self.GLOBAL_FLOCK, 'w')
            fcntl.flock(self.flock, fcntl.LOCK_EX)
            #make it rw by all if that's not already done.
            perms = stat.S_IRUSR | stat.S_IWUSR | stat.S_IRGRP | \
                    stat.S_IWGRP | stat.S_IROTH | stat.S_IWOTH
            s = os.fstat(self.flock.fileno())
            if not s.st_mode & perms == perms:
                logger.debug('Set flock permissions %s' %self.GLOBAL_FLOCK, self)
                os.fchmod(self.flock.fileno(), perms) 
開發者ID:bit-team,項目名稱:backintime,代碼行數:18,代碼來源:snapshots.py

示例11: name

# 需要導入模塊: import logger [as 別名]
# 或者: from logger import debug [as 別名]
def name(self):
        """
        Name of this snapshot

        Args:
            name (str): new name of the snapshot

        Returns:
            str:        name of this snapshot
        """
        nameFile = self.path(self.NAME)
        if not os.path.isfile(nameFile):
            return ''
        try:
            with open(nameFile, 'rt') as f:
                return f.read()
        except Exception as e:
            logger.debug('Failed to get snapshot {} name: {}'.format(
                         self.sid, str(e)),
                         self) 
開發者ID:bit-team,項目名稱:backintime,代碼行數:22,代碼來源:snapshots.py

示例12: unInhibitSuspend

# 需要導入模塊: import logger [as 別名]
# 或者: from logger import debug [as 別名]
def unInhibitSuspend(cookie, bus, dbus_props):
    """
    Release inhibit.
    """
    assert isinstance(cookie, int), 'cookie is not int type: %s' % cookie
    assert isinstance(bus, dbus.bus.BusConnection), 'bus is not dbus.bus.BusConnection type: %s' % bus
    assert isinstance(dbus_props, dict), 'dbus_props is not dict type: %s' % dbus_props
    try:
        interface = bus.get_object(dbus_props['service'], dbus_props['objectPath'])
        proxy = interface.get_dbus_method(dbus_props['methodUnSet'], dbus_props['interface'])
        proxy(cookie)
        logger.debug('Release inhibit Suspend')
        return None
    except dbus.exceptions.DBusException:
        logger.warning('Release inhibit Suspend failed.')
        return (cookie, bus, dbus_props) 
開發者ID:bit-team,項目名稱:backintime,代碼行數:18,代碼來源:tools.py

示例13: checkVersion

# 需要導入模塊: import logger [as 別名]
# 或者: from logger import debug [as 別名]
def checkVersion(self):
        """
        check encfs version.
        1.7.2 had a bug with --reverse that will create corrupt files
        """
        logger.debug('Check version', self)
        if self.reverse:
            proc = subprocess.Popen(['encfs', '--version'],
                                    stdout = subprocess.PIPE,
                                    stderr = subprocess.STDOUT,
                                    universal_newlines = True)
            output = proc.communicate()[0]
            m = re.search(r'(\d\.\d\.\d)', output)
            if m and StrictVersion(m.group(1)) <= StrictVersion('1.7.2'):
                logger.debug('Wrong encfs version %s' %m.group(1), self)
                raise MountException(_('encfs version 1.7.2 and before has a bug with option --reverse. Please update encfs')) 
開發者ID:bit-team,項目名稱:backintime,代碼行數:18,代碼來源:encfstools.py

示例14: startProcess

# 需要導入模塊: import logger [as 別名]
# 或者: from logger import debug [as 別名]
def startProcess(self):
        """
        start 'encfsctl encode' process in pipe mode.
        """
        thread = password_ipc.TempPasswordThread(self.password)
        env = self.encfs.env()
        env['ASKPASS_TEMP'] = thread.temp_file
        with thread.starter():
            logger.debug('start \'encfsctl encode\' process', self)
            encfsctl = ['encfsctl', 'encode', '--extpass=backintime-askpass', '/']
            logger.debug('Call command: %s'
                         %' '.join(encfsctl),
                         self)
            self.p = subprocess.Popen(encfsctl, env = env, bufsize = 0,
                                    stdin=subprocess.PIPE,
                                    stdout=subprocess.PIPE,
                                    universal_newlines = True) 
開發者ID:bit-team,項目名稱:backintime,代碼行數:19,代碼來源:encfstools.py

示例15: path

# 需要導入模塊: import logger [as 別名]
# 或者: from logger import debug [as 別名]
def path(self, path):
        """
        write plain path to encfsctl stdin and read encrypted path from stdout
        """
        if not 'p' in vars(self):
            self.startProcess()
        if not self.p.returncode is None:
            logger.warning('\'encfsctl encode\' process terminated. Restarting.', self)
            del self.p
            self.startProcess()
        self.p.stdin.write(path + '\n')
        ret = self.p.stdout.readline().strip('\n')
        if not len(ret) and len(path):
            logger.debug('Failed to encode %s. Got empty string'
                         %path, self)
            raise EncodeValueError()
        return ret 
開發者ID:bit-team,項目名稱:backintime,代碼行數:19,代碼來源:encfstools.py


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