Skip to content

Commit

Permalink
added utils.py for create logger
Browse files Browse the repository at this point in the history
  • Loading branch information
sherlyn99 committed Sep 5, 2024
1 parent af377ba commit 96b1e85
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
12 changes: 12 additions & 0 deletions micov/_utils.py
Original file line number Diff line number Diff line change
@@ -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
4 changes: 3 additions & 1 deletion micov/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]

Expand Down

0 comments on commit 96b1e85

Please sign in to comment.