def main(config_filename, gui_config, gui_job, override_csv_file_name, override_log_file_name, interrupted_ref): """ This function initialize the data logger and starts the logging process """ config = None gui_start = False if config_filename != None: # started via console config = load_and_validate_config(config_filename) if config == None: return None else: # started via GUI config = gui_config gui_start = True if override_csv_file_name != None: config['data']['csv']['file_name'] = override_csv_file_name if override_log_file_name != None: config['debug']['log']['file_name'] = override_log_file_name if config['debug']['log']['enabled']: EventLogger.add_logger(FileLogger('FileLogger', log_level_name_to_id(config['debug']['log']['level']), config['debug']['log']['file_name'])) try: data_logger = DataLogger(config, gui_job) if data_logger.ipcon is not None: data_logger.run() if not gui_start: while not interrupted_ref[0]: try: time.sleep(0.25) except: pass data_logger.stop() sys.exit(0) 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
def main(config_filename, gui_config, gui_job): """ This function initialize the data logger and starts the logging process """ config = None gui_start = False if config_filename != None: # started via console config = load_and_validate_config(config_filename) if config == None: return None else: # started via GUI config = gui_config gui_start = True if config['debug']['log']['enabled']: EventLogger.add_logger( FileLogger('FileLogger', log_level_name_to_id(config['debug']['log']['level']), config['debug']['log']['file_name'])) data_logger = None try: data_logger = DataLogger(config, gui_job) 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
def main(config_filename, gui_config, gui_job): """ This function initialize the data logger and starts the logging process """ config = None gui_start = False if config_filename != None: # started via console config = load_and_validate_config(config_filename) if config == None: return None else: # started via GUI config = gui_config gui_start = True if config['debug']['log']['enabled']: EventLogger.add_logger(FileLogger('FileLogger', log_level_name_to_id(config['debug']['log']['level']), config['debug']['log']['file_name'])) data_logger = None try: data_logger = DataLogger(config, gui_job) 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
def main(config_filename, gui_config, gui_job, override_csv_file_name, override_log_file_name, interrupted_ref): """ This function initialize the data logger and starts the logging process """ config = None gui_start = False if config_filename != None: # started via console config = load_and_validate_config(config_filename) if config == None: return None else: # started via GUI config = gui_config gui_start = True if override_csv_file_name != None: config['data']['csv']['file_name'] = override_csv_file_name if override_log_file_name != None: config['debug']['log']['file_name'] = override_log_file_name try: if config['debug']['log']['enabled']: EventLogger.add_logger( FileLogger( 'FileLogger', log_level_name_to_id(config['debug']['log']['level']), config['debug']['log']['file_name'])) data_logger = DataLogger(config, gui_job) if data_logger.ipcon is not None: data_logger.run() if not gui_start: while not interrupted_ref[0]: try: time.sleep(0.25) except: pass data_logger.stop() sys.exit(0) 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
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