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


Python Log.setFlushInterval方法代码示例

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


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

示例1: testSetFlushInterval

# 需要导入模块: from Acspy.Common import Log [as 别名]
# 或者: from Acspy.Common.Log import setFlushInterval [as 别名]
 def testSetFlushInterval(self):
     """PeriodicFlushCheck updates flush interval correctly"""
     Log.startPeriodicFlush()
     now = time.time()
     next = Log.NEXTEVENT
     Log.setFlushInterval(5)
     self.assertNotEqual(next, Log.NEXTEVENT)
     self.assertAlmostEqual(now + Log.INTERVAL, Log.NEXTEVENT[0],1)
     Log.stopPeriodicFlush()
开发者ID:,项目名称:,代码行数:11,代码来源:

示例2: testSetFlushIntervalInvalid

# 需要导入模块: from Acspy.Common import Log [as 别名]
# 或者: from Acspy.Common.Log import setFlushInterval [as 别名]
 def testSetFlushIntervalInvalid(self):
     """PeriodicFlushCheck flush thread stopped when invalid interval is set"""
     Log.startPeriodicFlush()
     Log.setFlushInterval(-5)
     self.assertEqual(False, Log.FLUSHTHREAD.isAlive())
     Log.stopPeriodicFlush()
开发者ID:,项目名称:,代码行数:8,代码来源:

示例3: refresh_logging_config

# 需要导入模块: from Acspy.Common import Log [as 别名]
# 或者: from Acspy.Common.Log import setFlushInterval [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.setFlushInterval方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。