From 96b1e85e428559ceced4ed82b48f184752b4a59e Mon Sep 17 00:00:00 2001 From: sherlyn99 Date: Thu, 5 Sep 2024 13:36:32 -0700 Subject: [PATCH] added utils.py for create logger --- micov/_utils.py | 12 ++++++++++++ micov/cli.py | 4 +++- 2 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 micov/_utils.py diff --git a/micov/_utils.py b/micov/_utils.py new file mode 100644 index 0000000..251f7ed --- /dev/null +++ b/micov/_utils.py @@ -0,0 +1,12 @@ +import logging + +def configure_logging(): + logger = logging.getLogger("micov") + logger.setLevel(logging.INFO) + # Check if the logger already has handlers (prevents adding multiple handlers) + if not logger.hasHandlers(): + handler = logging.StreamHandler() + formatter = logging.Formatter("%(asctime)s - %(name)s - %(levelname)s: %(message)s") + handler.setFormatter(formatter) + logger.addHandler(handler) + return logger \ No newline at end of file diff --git a/micov/cli.py b/micov/cli.py index 9e8643d..a4ee61f 100644 --- a/micov/cli.py +++ b/micov/cli.py @@ -109,7 +109,9 @@ def compress(data, output, disable_compression, lengths, taxonomy): taxonomy = parse_taxonomy(taxonomy) if os.path.isdir(data): - file_list = glob(data + "/*.sam") + glob(data + '/*.sam.xz') + glob(data + '/*.sam.gz') + file_list = (glob(data + "/*.sam") + + glob(data + '/*.sam.xz') + + glob(data + '/*.sam.gz')) else: file_list = [data]