diff --git a/scos_actions/actions/calibrate_y_factor.py b/scos_actions/actions/calibrate_y_factor.py index 94760341..11ced67c 100644 --- a/scos_actions/actions/calibrate_y_factor.py +++ b/scos_actions/actions/calibrate_y_factor.py @@ -152,7 +152,7 @@ def __init__(self, parameters, sigan, gps=None): try: self.iir_apply = get_parameter(IIR_APPLY, parameters) except ParameterException: - logger.info( + logger.debug( "Config parameter 'iir_apply' not provided. " + "No IIR filtering will be used during calibration." ) diff --git a/scos_actions/calibration/__init__.py b/scos_actions/calibration/__init__.py index 28f4359d..46fe9dbd 100644 --- a/scos_actions/calibration/__init__.py +++ b/scos_actions/calibration/__init__.py @@ -17,10 +17,9 @@ def get_sigan_calibration(sigan_cal_file: Path) -> Calibration: """ try: sigan_cal = load_from_json(sigan_cal_file) - except Exception as err: + except Exception: sigan_cal = None - logger.error("Unable to load sigan calibration data, reverting to none") - logger.exception(err) + logger.exception("Unable to load sigan calibration data, reverting to none") return sigan_cal @@ -34,10 +33,9 @@ def get_sensor_calibration(sensor_cal_file: Path) -> Calibration: """ try: sensor_cal = load_from_json(sensor_cal_file) - except Exception as err: + except Exception: sensor_cal = None - logger.error("Unable to load sensor calibration data, reverting to none") - logger.exception(err) + logger.exception("Unable to load sensor calibration data, reverting to none") return sensor_cal @@ -46,4 +44,4 @@ def get_sensor_calibration(sensor_cal_file: Path) -> Calibration: logger.info(f"Loading sigan cal file: {SIGAN_CALIBRATION_FILE}") sigan_calibration = get_sigan_calibration(SIGAN_CALIBRATION_FILE) if sensor_calibration: - logger.info(f"Last sensor cal: {sensor_calibration.last_calibration_datetime}") + logger.debug(f"Last sensor cal: {sensor_calibration.last_calibration_datetime}") diff --git a/scos_actions/capabilities/__init__.py b/scos_actions/capabilities/__init__.py index 7655434b..d17bd457 100644 --- a/scos_actions/capabilities/__init__.py +++ b/scos_actions/capabilities/__init__.py @@ -11,7 +11,7 @@ SENSOR_DEFINITION_HASH = None SENSOR_LOCATION = None -logger.info(f"Loading {SENSOR_DEFINITION_FILE}") +logger.debug(f"Loading {SENSOR_DEFINITION_FILE}") try: capabilities["sensor"] = utils.load_from_json(SENSOR_DEFINITION_FILE) except Exception as e: @@ -32,7 +32,7 @@ sensor_loc["z"] if "z" in sensor_loc else None, ) except: - logger.warning("Failed to get sensor location from sensor definition.") + logger.exception("Failed to get sensor location from sensor definition.") # Generate sensor definition file hash (SHA 512) try: @@ -41,7 +41,6 @@ SENSOR_DEFINITION_HASH = hashlib.sha512(sensor_def.encode("UTF-8")).hexdigest() capabilities["sensor"]["sensor_sha512"] = SENSOR_DEFINITION_HASH except: - logger.error(f"Unable to generate sensor definition hash") capabilities["sensor"]["sensor_sha512"] = "ERROR GENERATING HASH" # SENSOR_DEFINITION_HASH is None, do not raise Exception - logger.debug(e) + logger.exception(f"Unable to generate sensor definition hash") diff --git a/scos_actions/discover/yaml.py b/scos_actions/discover/yaml.py index ace3102f..bf76d9bd 100644 --- a/scos_actions/discover/yaml.py +++ b/scos_actions/discover/yaml.py @@ -17,22 +17,20 @@ def load_from_yaml(action_classes, sigan, gps, yaml_dir: Path = ACTION_DEFINITIO definition = yaml.load(yaml_file) for class_name, parameters in definition.items(): try: - logger.debug("Attempting to configure: " + class_name) + logger.debug(f"Attempting to configure: {class_name}") action = action_classes[class_name]( parameters=parameters, sigan=sigan, gps=gps ) parsed_actions[action.name] = action except KeyError as exc: err = "Nonexistent action class name {!r} referenced in {!r}" - logger.error(err.format(class_name, yaml_file.name)) - logger.exception(exc) + logger.exception(err.format(class_name, yaml_file.name)) raise exc except TypeError as exc: err = "Invalid parameter list {!r} referenced in {!r}" - logger.error(err.format(parameters, yaml_file.name)) - logger.exception(exc) + logger.exception(err.format(parameters, yaml_file.name)) raise exc except Exception as exc: - logger.error("Unable to load yaml:", exc, class_name, parameters) + logger.exception("Unable to load yaml:", class_name, parameters) raise exc return parsed_actions diff --git a/scos_actions/hardware/__init__.py b/scos_actions/hardware/__init__.py index 3f5b2ca8..c2a84675 100644 --- a/scos_actions/hardware/__init__.py +++ b/scos_actions/hardware/__init__.py @@ -24,14 +24,14 @@ def load_switches(switch_dir: Path) -> dict: if switch_dir is not None and switch_dir.is_dir(): for f in switch_dir.iterdir(): file_path = f.resolve() - logger.info(f"loading switch config {file_path}") + logger.debug(f"loading switch config {file_path}") conf = utils.load_from_json(file_path) try: switch = ControlByWebWebRelay(conf) - logger.info(f"Adding {switch.id}") + logger.debug(f"Adding {switch.id}") switch_dict[switch.id] = switch - logger.info(f"Registering switch status for {switch.name}") + logger.debug(f"Registering switch status for {switch.name}") register_component_with_status.send(__name__, component=switch) except ConfigurationException: logger.error(f"Unable to configure switch defined in: {file_path}") @@ -49,7 +49,7 @@ def load_preselector_from_file(preselector_config_file: Path): preselector_config, PRESELECTOR_MODULE, PRESELECTOR_CLASS ) except ConfigurationException: - logger.error( + logger.exception( f"Unable to create preselector defined in: {preselector_config_file}" ) return None diff --git a/scos_actions/hardware/mocks/mock_sigan.py b/scos_actions/hardware/mocks/mock_sigan.py index b1e82bca..46b8f2ec 100644 --- a/scos_actions/hardware/mocks/mock_sigan.py +++ b/scos_actions/hardware/mocks/mock_sigan.py @@ -140,7 +140,7 @@ def acquire_time_domain_samples( data_len = len(data) if not len(data) == num_samples: if retries > 0: - msg = "USRP error: requested {} samples, but got {}." + msg = "Signal analyzer error: requested {} samples, but got {}." logger.warning(msg.format(num_samples + num_samples_skip, data_len)) logger.warning(f"Retrying {retries} more times.") retries = retries - 1 diff --git a/scos_actions/hardware/sigan_iface.py b/scos_actions/hardware/sigan_iface.py index 99e25ab9..a12c1d67 100644 --- a/scos_actions/hardware/sigan_iface.py +++ b/scos_actions/hardware/sigan_iface.py @@ -126,7 +126,7 @@ def power_cycle_and_connect(self, sleep_time: float = 2.0) -> None: try: power_cycle_sigan() except HardwareConfigurationException as hce: - logger.warn(f"Unable to power cycle sigan: {hce}") + logger.warning(f"Unable to power cycle sigan: {hce}") return try: # Wait for power cycle to complete @@ -134,9 +134,9 @@ def power_cycle_and_connect(self, sleep_time: float = 2.0) -> None: time.sleep(sleep_time) logger.info("Power cycled signal analyzer. Reconnecting...") self.connect() - except Exception as e: - logger.error( - f"Unable to reconnect to signal analyzer after power cycling: {e}" + except Exception: + logger.exception( + "Unable to reconnect to signal analyzer after power cycling" ) return diff --git a/scos_actions/settings.py b/scos_actions/settings.py index 8ee0015c..e8236f75 100644 --- a/scos_actions/settings.py +++ b/scos_actions/settings.py @@ -7,7 +7,7 @@ logger = logging.getLogger(__name__) env = Env() -logger.info("Initializing scos-actions settings") +logger.debug("Initializing scos-actions settings") CONFIG_DIR = Path(__file__).parent.resolve() / "configs" ACTION_DEFINITIONS_DIR = CONFIG_DIR / "actions" diff --git a/scos_actions/status/status_monitor.py b/scos_actions/status/status_monitor.py index 938e1181..dd76d00b 100644 --- a/scos_actions/status/status_monitor.py +++ b/scos_actions/status/status_monitor.py @@ -5,7 +5,7 @@ class StatusMonitor: def __init__(self): - logger.info("Initializing StatusMonitor") + logger.debug("Initializing StatusMonitor") self.status_components = [] def add_component(self, component):