Python logging.config 模块,sections() 实例源码

我们从Python开源项目中,提取了以下8个代码示例,用于说明如何使用logging.config.sections()

项目:PiBunny    作者:tholum    | 项目源码 | 文件源码
def processConfigFile(self, configFile=None):
       if configFile is not None:
           self.__serverConfig = ConfigParser.ConfigParser()
           self.__serverConfig.read(configFile)
       sections = self.__serverConfig.sections()
       # Let's check the log file
       self.__logFile      = self.__serverConfig.get('global','log_file')
       if self.__logFile != 'None':
            logging.basicConfig(filename = self.__logFile, 
                             level = logging.DEBUG, 
                             format="%(asctime)s: %(levelname)s: %(message)s", 
                             datefmt = '%m/%d/%Y %I:%M:%S %p')

       # Remove the global one
       del(sections[sections.index('global')])
       self._shares = {}
       for i in sections:
           self._shares[i] = dict(self.__serverConfig.items(i))
项目:CVE-2017-7494    作者:joxeankoret    | 项目源码 | 文件源码
def processConfigFile(self, configFile=None):
       if configFile is not None:
           self.__serverConfig = ConfigParser.ConfigParser()
           self.__serverConfig.read(configFile)
       sections = self.__serverConfig.sections()
       # Let's check the log file
       self.__logFile      = self.__serverConfig.get('global','log_file')
       if self.__logFile != 'None':
            logging.basicConfig(filename = self.__logFile, 
                             level = logging.DEBUG, 
                             format="%(asctime)s: %(levelname)s: %(message)s", 
                             datefmt = '%m/%d/%Y %I:%M:%S %p')

       # Remove the global one
       del(sections[sections.index('global')])
       self._shares = {}
       for i in sections:
           self._shares[i] = dict(self.__serverConfig.items(i))
项目:kekescan    作者:xiaoxiaoleo    | 项目源码 | 文件源码
def processConfigFile(self, configFile=None):
       if configFile is not None:
           self.__serverConfig = ConfigParser.ConfigParser()
           self.__serverConfig.read(configFile)
       sections = self.__serverConfig.sections()
       # Let's check the log file
       self.__logFile      = self.__serverConfig.get('global','log_file')
       if self.__logFile != 'None':
            logging.basicConfig(filename = self.__logFile, 
                             level = logging.DEBUG, 
                             format="%(asctime)s: %(levelname)s: %(message)s", 
                             datefmt = '%m/%d/%Y %I:%M:%S %p')

       # Remove the global one
       del(sections[sections.index('global')])
       self._shares = {}
       for i in sections:
           self._shares[i] = dict(self.__serverConfig.items(i))
项目:PiBunny    作者:tholum    | 项目源码 | 文件源码
def getShares(connId, smbServer):
    config = smbServer.getServerConfig()
    sections = config.sections()
    # Remove the global one
    del(sections[sections.index('global')])
    shares = {}
    for i in sections:
        shares[i] = dict(config.items(i))
    return shares
项目:CVE-2017-7494    作者:joxeankoret    | 项目源码 | 文件源码
def getShares(connId, smbServer):
    config = smbServer.getServerConfig()
    sections = config.sections()
    # Remove the global one
    del(sections[sections.index('global')])
    shares = {}
    for i in sections:
        shares[i] = dict(config.items(i))
    return shares
项目:nginx-nr-agent    作者:skyzyx    | 项目源码 | 文件源码
def read_config(self):
        # if self.config:
        #     return

        config = ConfigParser.RawConfigParser()
        config.read(self.config_file)

        for s in config.sections():
            if s == 'global':
                if config.has_option(s, 'poll_interval'):
                    self.poll_interval = int(config.get(s, 'poll_interval'))
                if config.has_option(s, 'newrelic_license_key'):
                    self.license_key = config.get(s, 'newrelic_license_key')
                continue

            if not config.has_option(s, 'name') or not config.has_option(s, 'url'):
                continue

            ns = NginxStatusCollector(s, config.get(s, 'name'), config.get(s, 'url'), self.poll_interval)

            if config.has_option(s, 'http_user') and config.has_option(s, 'http_pass'):
                ns.basic_auth = base64.b64encode(config.get(s, 'http_user') + b':' + config.get(s, 'http_pass'))

            self.sources.append(ns)

        self.config = config
项目:kekescan    作者:xiaoxiaoleo    | 项目源码 | 文件源码
def getShares(connId, smbServer):
    config = smbServer.getServerConfig()
    sections = config.sections()
    # Remove the global one
    del(sections[sections.index('global')])
    shares = {}
    for i in sections:
        shares[i] = dict(config.items(i))
    return shares
项目:HoneySMB    作者:r0hi7    | 项目源码 | 文件源码
def getShares(connId, smbServer):
    config = smbServer.getServerConfig()
    sections = config.sections()
    # Remove the global one
    del(sections[sections.index('global')])
    shares = {}
    for i in sections:
        shares[i] = dict(config.items(i))
    return shares