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


Python Log.getDefaultLevels方法代码示例

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


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

示例1: get_default_logLevels

# 需要导入模块: from Acspy.Common import Log [as 别名]
# 或者: from Acspy.Common.Log import getDefaultLevels [as 别名]
    def get_default_logLevels(self): # pragma: NO COVER
        '''
        Retrieve the default log levels used in this container.

        Returns: maci.LoggingConfigurable.LogLevels instance containing default log level values

        Raises: Nothing
        '''
        return Log.getDefaultLevels()
开发者ID:,项目名称:,代码行数:11,代码来源:

示例2: configureComponentLogger

# 需要导入模块: from Acspy.Common import Log [as 别名]
# 或者: from Acspy.Common.Log import getDefaultLevels [as 别名]
    def configureComponentLogger(self, name):
        '''
        Configure the logger for the given component name from the values in the CDB.

        Parameters:
        name is the name of the component
        '''
        # Each component has an associated logger instance
        clogger = Log.getLogger(name)

        # Default levels are used for missing values
        defaultlevels = Log.getDefaultLevels()
        
        try:
            #Get the global unnamed logging config to retrieve the maxLogsPerSecond attribute
            logconfigG = self.cdbAccess.getElement("MACI/Containers/"  + self.name + "/LoggingConfig", "LoggingConfig")
            maxLogsPerSec = int(logconfigG[0]['maxLogsPerSecond'])
        except (Exception):
            # No value was supplied so default is used
            maxLogsPerSec = -1
        
        try:
            # Process all the named logger configurations
            logconfig = self.cdbAccess.getElement("MACI/Containers/"  + self.name + "/LoggingConfig", "LoggingConfig/log:_")
            for cfg in logconfig:
                if cfg["Name"] == name:
                    try:
                        centrallevel = int(cfg['minLogLevel'])
                    except KeyError:
                        # No value was supplied so default is used
                        centrallevel = defaultlevels.minLogLevel
                    try:
                        locallevel = int(cfg['minLogLevelLocal'])
                    except KeyError:
                        # No value was supplied so default is used
                        locallevel = defaultlevels.minLogLevelLocal
                    
                    clogger.setLevels(maci.LoggingConfigurable.LogLevels(False, centrallevel, locallevel))
                    clogger.configureLogging(maxLogsPerSec)
                    # There should only be one entry per logger so we are done
                    break
            else:
                # No matching named logger was found so the default values are used
                clogger.setLevels(maci.LoggingConfigurable.LogLevels(True, 0, 0))
        except Exception:
            # No named loggers were defined so the default values are used
            clogger.setLevels(maci.LoggingConfigurable.LogLevels(True, 0, 0))
开发者ID:,项目名称:,代码行数:49,代码来源:


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