From 431550801967a176c74a74392ce86a56ecf78d73 Mon Sep 17 00:00:00 2001 From: Jakob Nybo Nissen Date: Mon, 22 Apr 2024 12:40:09 +0200 Subject: [PATCH] Add stderr logger early in main Because we remove the default logger on init, but only add the new logger when run() is called, there is no logger available during the preprocessing steps, e.g. argparsing. This leads to warnings not being shown to the user, which is very bad from a usability point of view. --- vamb/__main__.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/vamb/__main__.py b/vamb/__main__.py index 9384199f..6441b3df 100755 --- a/vamb/__main__.py +++ b/vamb/__main__.py @@ -1398,7 +1398,6 @@ def run(self): logger.add( self.vamb_options.out_dir.joinpath(self.LOGS_PATH), format=format_log ) - logger.add(sys.stderr, format=format_log) begintime = time.time() logger.info("Starting Vamb version " + vamb.__version_str__) logger.info("Random seed is " + str(self.vamb_options.seed)) @@ -2064,6 +2063,8 @@ def main(): vamb bin default --outdir out --fasta my_contigs.fna --bamfiles *.bam -o C Find the latest updates and documentation at https://github.com/RasmussenLab/vamb""" + logger.add(sys.stderr, format=format_log) + parser = argparse.ArgumentParser( prog="vamb", description=doc,