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


Python EventLogger.error方法代码示例

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


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

示例1: btn_remove_device_clicked

# 需要导入模块: from brickv.data_logger.event_logger import EventLogger [as 别名]
# 或者: from brickv.data_logger.event_logger.EventLogger import error [as 别名]
    def btn_remove_device_clicked(self):
        """
            Removes selected Device
        """
        selected_item = self.tree_devices.selectedItems()
        for index in range(0, len(selected_item)):
            try:
                if selected_item[index] is None:
                    continue

                device_name = selected_item[index].text(0)
                device_id = selected_item[index].text(1)

                if selected_item[index].text(0) not in Identifier.DEVICE_DEFINITIONS:
                    # have to find the parent
                    current_item = selected_item[0]

                    while True:
                        if current_item.parent() is None:
                            if current_item.text(0) not in Identifier.DEVICE_DEFINITIONS:
                                EventLogger.error("Cant remove device: " + selected_item[index].text(0))
                                device_name = ""
                                device_id = ""
                                break
                            else:
                                device_name = current_item.text(0)
                                device_id = current_item.text(1)
                                break
                        else:
                            current_item = current_item.parent()

                self.remove_item_from_tree(device_name, device_id)
            except Exception as e:
                if not str(e).startswith("wrapped C/C++ object"):
                    EventLogger.error("Cant remove device: " + str(e))  # was already removed
开发者ID:Loremipsum1988,项目名称:brickv,代码行数:37,代码来源:logger_setup.py

示例2: main

# 需要导入模块: from brickv.data_logger.event_logger import EventLogger [as 别名]
# 或者: from brickv.data_logger.event_logger.EventLogger import error [as 别名]
def main(arguments_map):
    """
    This function initialize the data logger and starts the logging process
    """
    EventLogger.add_logger(ConsoleLogger("ConsoleLogger", 20))#logging.info

    configuration = None
    gui_start = False
    try:
        # was started via console
        if CONSOLE_CONFIG_FILE in arguments_map and arguments_map[CONSOLE_CONFIG_FILE] is not None:
            configuration = CR(path_to_config=arguments_map[CONSOLE_CONFIG_FILE])

        # was started via gui
        elif GUI_CONFIG in arguments_map and arguments_map[GUI_CONFIG] is not None:
            gui_start = True
            configuration = CR(configuration=arguments_map[GUI_CONFIG])

        # no configuration file was given
        else:
            raise DataLoggerException(desc="Can not run data logger without a configuration.")

        if CONSOLE_VALIDATE_ONLY in arguments_map and arguments_map[CONSOLE_VALIDATE_ONLY]:
            return

        # activate eventlogger
        __manage_eventlog(configuration._configuration._general)

    except Exception as exc:
        EventLogger.critical(str(exc))
        if gui_start:
            return None
        else:
            sys.exit(DataLoggerException.DL_CRITICAL_ERROR)

    if configuration._configuration.is_empty():
        EventLogger.error("Configuration is empty")
        return None

    data_logger = None
    try:
        if gui_start:
            data_logger = DataLogger(configuration._configuration, arguments_map[GUI_ELEMENT])
        else:
            data_logger = DataLogger(configuration._configuration)

        if data_logger.ipcon is not None:
            data_logger.run()
            if not gui_start:
                __exit_condition(data_logger)
        else:
            raise DataLoggerException(DataLoggerException.DL_CRITICAL_ERROR,
                                      "DataLogger did not start logging process! Please check for errors.")

    except Exception as exc:
        EventLogger.critical(str(exc))
        if gui_start:
            return None
        else:
            sys.exit(DataLoggerException.DL_CRITICAL_ERROR)

    return data_logger
开发者ID:Loremipsum1988,项目名称:brickv,代码行数:64,代码来源:main.py


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