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


Python Logger.error方法代码示例

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


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

示例1: AthenaOpt

# 需要导入模块: from common import Logger [as 别名]
# 或者: from common.Logger import error [as 别名]
class AthenaOpt(object):
    """
    The primary class for AthenaOpt that controls program logic.
    """

    def __init__(self):
        """
        AthenaOpt constructor
        @return: None
        """

        self._configuration = None
        self._logger = None
        self._directory = None

    def run(self, configuration):
        """
        Run the optimization and place output files in the directory specified by the configuration.
        @param configuration: The optimization configuration object
        @type configuration: Configuration
        @return: The run history
        @rtype: History
        """

        # Parse the configuration
        self._configuration = configuration
        self._directory = self._configuration.get_directory()
        if not path.exists(self._directory):
            makedirs(self._directory)

        self._logger = Logger(self._directory + '/' + configuration.get_log_file(),
                              configuration.get_log_level(), configuration.get_console_log_level())
        self._logger.info('Athena optimization run started')

        # Load the model
        if self._configuration.get_model() == 'ZDT1':
            model = ZDT1()
            self._logger.info('Model ZDT1 selected')

        elif self._configuration.get_model() == 'ZDT2':
            model = ZDT2()
            self._logger.info('Model ZDT2 selected')

        elif self._configuration.get_model() == 'ZDT3':
            model = ZDT3()
            self._logger.info('Model ZDT3 selected')

        elif self._configuration.get_model() == 'ZDT4':
            model = ZDT4()
            self._logger.info('Model ZDT4 selected')

        elif self._configuration.get_model() == 'ZDT6':
            model = ZDT6()
            self._logger.info('Model ZDT6 selected')

        elif self._configuration.get_model() == 'DTLZ1':
            model = DTLZ1()
            self._logger.info('Model DTLZ1 selected')

        elif self._configuration.get_model() == 'DTLZ2':
            model = DTLZ2()
            self._logger.info('Model DTLZ2 selected')

        elif self._configuration.get_model() == 'DTLZ3':
            model = DTLZ3()
            self._logger.info('Model DTLZ3 selected')

        elif self._configuration.get_model() == 'TNK':
            model = TNK()
            self._logger.info('Model TNK selected')

        elif self._configuration.get_model() == 'PACKING':
            model = PACKING()
            self._logger.info('Model PACKING selected')

        elif self._configuration.get_model() == 'POLONI':
            model = POLONI()
            self._logger.info('Model POLONI selected')

        else:
            self._logger.error('Unable to determine model ' + self._configuration.get_model())
            raise AthenaException('Unable to determine model ' + self._configuration.get_model())

        # Load the algorithm
        if self._configuration.get_algorithm() == 'SERIAL':
            algorithm = Serial()
            self._logger.info('Algorithm SERIAL selected')

        elif self._configuration.get_algorithm() == 'ISLANDS':
            algorithm = Islands()
            self._logger.info('Algorithm ISLANDS selected')

        elif self._configuration.get_algorithm() == 'SPHERES':
            algorithm = Spheres()
            self._logger.info('Algorithm SPHERES selected')

        else:
            self._logger.error('Unable to determine algorithm ' + self._configuration.get_algorithm())
            raise AthenaException('Unable to determine algorithm ' + self._configuration.get_algorithm())

#.........这里部分代码省略.........
开发者ID:jldaniel,项目名称:Athena,代码行数:103,代码来源:athena_opt.py


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