Skip to content

Commit bec2747

Browse files
authored
fixed CLI duplicate bug (#449)
CSVReader had a log output that none of the other logs had. This caused duplicate CLI prints when sample reader and full reader were called. I've moved this log to convert.py so it only occurs once. logger.propagate was set to False to avoid other duplicate logs such as in the output file log.
1 parent c1db954 commit bec2747

3 files changed

Lines changed: 2 additions & 2 deletions

File tree

src/layup/convert.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -784,6 +784,7 @@ def convert_cli(
784784

785785
sample_data = sample_reader.read_rows(block_start=0, block_size=1)
786786

787+
logger.info(f"Reading the first line of {input_file} as header:\n{sample_data.dtype.names}\n")
787788
# Check orbit format in the file
788789
input_format = get_format(sample_data)
789790

src/layup/utilities/file_io/CSVReader.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,6 @@ def _validate_header_line(self):
133133
# Skip comment lines
134134
self.num_pre_header_lines += 1
135135
else:
136-
logger.info(f"Reading the first line of {self.filename} as header:\n{line}")
137136
self._check_header_line(line)
138137
# Note - header row INDEX is 0-indexed.
139138
self.header_row_index = self.num_pre_header_lines

src/layup/utilities/layup_logging.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ def _prepare_logger(self, log_directory="."):
9494
"""
9595

9696
logger = logging.getLogger("layup")
97-
97+
logger.propagate = False
9898
# This logger handles all messages >= DEBUG
9999
logger.setLevel(logging.DEBUG)
100100

0 commit comments

Comments
 (0)