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


Python Log.setDefaultLevels方法代码示例

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


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

示例1: testLoggerDefault

# 需要导入模块: from Acspy.Common import Log [as 别名]
# 或者: from Acspy.Common.Log import setDefaultLevels [as 别名]
 def testLoggerDefault(self):
     """SeveralLoggerCheck Levels changes on all loggers using default level"""
     Log.setDefaultLevels(maci.LoggingConfigurable.LogLevels(False,4, 5))
     self.assertEquals(True, self.plogger.usingDefault)
     self.assertEquals(True, self.clogger.usingDefault)
     self.assertEquals(Log.DEFAULTLOCALHANDLER.level, self.plogger.stdouthandler.level)
     self.assertEquals(Log.DEFAULTCENTRALHANDLER.level, self.plogger.acshandler.level)
     self.assertEquals(Log.DEFAULTLOCALHANDLER.level, self.clogger.stdouthandler.level)
     self.assertEquals(Log.DEFAULTCENTRALHANDLER.level, self.plogger.acshandler.level)
开发者ID:,项目名称:,代码行数:11,代码来源:

示例2: set_default_logLevels

# 需要导入模块: from Acspy.Common import Log [as 别名]
# 或者: from Acspy.Common.Log import setDefaultLevels [as 别名]
    def set_default_logLevels(self, levels): # pragma: NO COVER
        '''
        Set the default log level for this container.

        Parameter:
        levels - maci.LoggingConfigurable.LogLevels instance containing default log level values

        Raises: Nothing
        '''
        Log.setDefaultLevels(levels)
开发者ID:,项目名称:,代码行数:12,代码来源:

示例3: tearDown

# 需要导入模块: from Acspy.Common import Log [as 别名]
# 或者: from Acspy.Common.Log import setDefaultLevels [as 别名]
 def tearDown(self):
     Log.setDefaultLevels(maci.LoggingConfigurable.LogLevels(False,3, 3))
     self.plogger.setLevels(maci.LoggingConfigurable.LogLevels(True,0, 0))
     self.clogger.setLevels(maci.LoggingConfigurable.LogLevels(True,0, 0))
开发者ID:,项目名称:,代码行数:6,代码来源:

示例4: testSetDefaultLevels

# 需要导入模块: from Acspy.Common import Log [as 别名]
# 或者: from Acspy.Common.Log import setDefaultLevels [as 别名]
 def testSetDefaultLevels(self):
     """Log sets default handlers levels correctly for valid inputs"""
     for k in Log.LEVELS:
         Log.setDefaultLevels(maci.LoggingConfigurable.LogLevels(False, k, k))
         self.assertEqual(Log.LEVELS[k], Log.DEFAULTLOCALHANDLER.level)
         self.assertEqual(Log.LEVELS[k], Log.DEFAULTCENTRALHANDLER.level)
开发者ID:,项目名称:,代码行数:8,代码来源:

示例5: refresh_logging_config

# 需要导入模块: from Acspy.Common import Log [as 别名]
# 或者: from Acspy.Common.Log import setDefaultLevels [as 别名]
    def refresh_logging_config(self):
        '''
        Reset the logging configuration to the original CDB settings.

        Returns:  Nothing

        Raises:  Nothing
        '''

        # Default values from the XML Schema
        lcfg = LoggingConfig_xsd.LoggingConfig()
        centrallevel = lcfg.minLogLevel
        locallevel = lcfg.minLogLevelLocal
        cap = lcfg.maxLogQueueSize
        batch = lcfg.dispatchPacketSize
        displevel = lcfg.immediateDispatchLevel
        flush = lcfg.flushPeriodSeconds

        # Retrieve the CDB information
        try:
            logconfig = self.cdbAccess.getElement("MACI/Containers/"  + self.name + "/LoggingConfig", "LoggingConfig")
            try:
                centrallevel = int(logconfig[0]['minLogLevel'])
            except:
                # Default value used because CDB has no setting for this attribute
                pass
            try:
                locallevel = int(logconfig[0]['minLogLevelLocal'])
            except:
                # Default value used because CDB has no setting for this attribute
                pass
            try:
                cap = int(logconfig[0]['maxLogQueueSize'])
            except:
                # Default value used because CDB has no setting for this attribute
                pass
            try:
                batch = int(logconfig[0]['dispatchPacketSize'])
            except:
                # Default value used because CDB has no setting for this attribute
                pass
            try:
                displevel = int(logconfig[0]['immediateDispatchLevel'])
            except:
                # Default value used because CDB has no setting for this attribute
                pass
            try:
                flush = int(logconfig[0]['flushPeriodSeconds'])
            except:
                # Default value used because CDB has no setting for this attribute
                pass

            # Refresh all named loggers from the CDB as well.
            for log in self.get_logger_names():
                self.configureComponentLogger(log)
        except:
            # No logging configuration given in the CDB so defaults are used.
            pass

        # Environment variable takes precedence over the CDB value
        if 'ACS_LOG_CENTRAL' in environ:
            centrallevel = int(environ['ACS_LOG_CENTRAL'])

        if 'ACS_LOG_STDOUT' in environ:
            locallevel = int(environ['ACS_LOG_STDOUT'])

        Log.setDefaultLevels(maci.LoggingConfigurable.LogLevels(False, centrallevel, locallevel))
        Log.setCapacity(cap)
        Log.setBatchSize(batch)
        Log.setImmediateDispatchLevel(displevel)

        # No need to create another flush thread when one already exists.
        if Log.isFlushRunning():
            Log.setFlushInterval(flush)
        else:
            Log.startPeriodicFlush(flush)
开发者ID:,项目名称:,代码行数:78,代码来源:


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