From 36430a7d3e6e3e06ecc6b122d2c4ffcf3ef91eb8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Al=C3=A1n=20Mu=C3=B1oz?= <alan.munoz@ed.ac.uk> Date: Wed, 11 Jan 2023 16:36:21 +0000 Subject: [PATCH] change(aliby): Replace prints -> self._log --- src/agora/io/signal.py | 4 ++-- src/aliby/tile/tiler.py | 5 ++--- src/logfile_parser/swainlab_parser.py | 5 ++++- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/agora/io/signal.py b/src/agora/io/signal.py index e7160390..2578b57c 100644 --- a/src/agora/io/signal.py +++ b/src/agora/io/signal.py @@ -240,7 +240,7 @@ class Signal(BridgeH5): f.visititems(self.store_signal_url) except Exception as e: - print("Error visiting h5: {}".format(e)) + self._log("Exception when visiting h5: {}".format(e), "exception") return self._available @@ -289,7 +289,7 @@ class Signal(BridgeH5): return df except Exception as e: - print(f"Could not fetch dataset {dataset}") + self._log(f"Could not fetch dataset {dataset}", "error") raise e def get_merges(self): diff --git a/src/aliby/tile/tiler.py b/src/aliby/tile/tiler.py index 58fe00a1..73096720 100644 --- a/src/aliby/tile/tiler.py +++ b/src/aliby/tile/tiler.py @@ -493,9 +493,8 @@ class Tiler(StepABC): return None def get_traps_timepoint(self, *args, **kwargs): - # - print( - DeprecationWarning("Deprecated:Use get_tiles_timepoint instead.") + self._log( + "get_trap_timepoints is deprecated; get_tiles_timepoint instead." ) return self.get_tiles_timepoint(*args, **kwargs) diff --git a/src/logfile_parser/swainlab_parser.py b/src/logfile_parser/swainlab_parser.py index a83cb87c..1a0d1763 100644 --- a/src/logfile_parser/swainlab_parser.py +++ b/src/logfile_parser/swainlab_parser.py @@ -32,6 +32,7 @@ New grammar - Tables are assumed to end with an empty line. """ +import logging import typing as t from pathlib import PosixPath @@ -229,7 +230,9 @@ def parse_from_grammar(filepath: str, grammar: t.Dict): subkey = "_".join((key, subkey)) d[subkey] = parse_x(header, **subvalues) except Exception as e: - print(f"Parsing failed for key {key}") + logging.getLogger("aliby").critical( + f"Parsing failed for key {key}" + ) raise (e) return d -- GitLab