diff --git a/romancal/associations/association.py b/romancal/associations/association.py index b9bb7425d..bc270cab6 100644 --- a/romancal/associations/association.py +++ b/romancal/associations/association.py @@ -197,7 +197,8 @@ def validate(cls, asn): try: jsonschema.validate(asn_data, asn_schema) except (AttributeError, jsonschema.ValidationError) as err: - logger.debug("Validation failed:\n%s", err) + logger.debug("Validation failed:") + logger.debug("%s", err) raise AssociationNotValidError("Validation failed") from err return True diff --git a/romancal/associations/generate.py b/romancal/associations/generate.py index ed35dff30..f8f012c80 100644 --- a/romancal/associations/generate.py +++ b/romancal/associations/generate.py @@ -94,7 +94,7 @@ def generate(pool, rules, version_id=None, finalize=True): logger.debug("New process lists: %d", total_reprocess) logger.debug("Updated process queue: %s", process_queue) logger.debug("# associations: %d", len(associations)) - logger.debug("Seconds to process: %.2f\n", timer() - time_start) + logger.debug("Seconds to process: %.2f", timer() - time_start) # Finalize found associations logger.debug("# associations before finalization: %d", len(associations)) diff --git a/romancal/associations/lib/log_config.py b/romancal/associations/lib/log_config.py index 81b67a426..36b742b47 100644 --- a/romancal/associations/lib/log_config.py +++ b/romancal/associations/lib/log_config.py @@ -3,7 +3,6 @@ import logging import sys from collections import defaultdict -from functools import partialmethod from logging.config import dictConfig __all__ = ["log_config"] @@ -130,28 +129,6 @@ def format(self, record): } -class MultilineLogger(logging.getLoggerClass()): - """Split multilines so that each line is logged separately""" - - def __init__(self, *args, **kwargs): - super().__init__(*args, **kwargs) - - def log(self, level, msg, *args, **kwargs): - if self.isEnabledFor(level): - for line in msg.split("\n"): - self._log(level, line, args, **kwargs) - - debug = partialmethod(log, logging.DEBUG) - info = partialmethod(log, logging.INFO) - warning = partialmethod(log, logging.WARNING) - error = partialmethod(log, logging.ERROR) - critical = partialmethod(log, logging.CRITICAL) - fatal = critical - - -logging.setLoggerClass(MultilineLogger) - - def log_config(name=None, user_name=None, logger_config=None, config=None, merge=True): """Setup logging with defaults diff --git a/romancal/flux/flux_step.py b/romancal/flux/flux_step.py index a4624ce96..79d820199 100644 --- a/romancal/flux/flux_step.py +++ b/romancal/flux/flux_step.py @@ -105,11 +105,10 @@ def apply_flux_correction(model): VARIANCES = ("var_rnoise", "var_poisson", "var_flat") if model.data.unit == model.meta.photometry.conversion_megajanskys.unit: - message = ( + log.info( f"Input data is already in flux units of {model.meta.photometry.conversion_megajanskys.unit}." - "\nFlux correction already applied." ) - log.info(message) + log.info("Flux correction already applied.") return if model.data.unit != LV2_UNITS: @@ -117,7 +116,7 @@ def apply_flux_correction(model): f"Input data units {model.data.unit} are not in the expected units of {LV2_UNITS}" "\nAborting flux correction" ) - log.error(message) + [log.error(line) for line in message.splitlines()] raise ValueError(message) # Apply the correction.