Skip to content

Commit

Permalink
Merge pull request #47 from cmatKhan/develop
Browse files Browse the repository at this point in the history
bump to 0.2.2
  • Loading branch information
cmatKhan authored Aug 31, 2023
2 parents 9ddf2d2 + 94e22cd commit e81dd43
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 37 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "isocomp"
version = "0.2.1"
version = "0.2.2"
description = ""
authors = ["Yutong Qiu <[email protected]>", "Chia Sin Liew <[email protected]>", "Rupesh Kesharwani <[email protected]>",
"Bida Gu <[email protected]>", "chase mateusiak <[email protected]>",
Expand Down
31 changes: 6 additions & 25 deletions src/isocomp/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
# local imports
from .Coordinates import create_comparison_windows
from .Compare import find_unique_isoforms
from .utils.configure_logging import configure_logging

logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -328,34 +329,14 @@ def main(args=None) -> None:
# help message
try:
log_level = args.log_level.upper()
if log_level not in ['CRITICAL', 'ERROR', 'WARNING', 'INFO', 'DEBUG']:
raise ValueError("The logging level must be one of debug, "
"info, warning, error, "
"or critical.")
except AttributeError:
sys.exit(arg_parser.print_help())

# set the logging details
log_config = {
"version": 1,
"root": {
"handlers": ["console"],
"level": f"{log_level}"
},
"handlers": {
"console": {
"formatter": "std_out",
"class": "logging.StreamHandler"
}
},
"formatters": {
"std_out": {
"format": "%(asctime)s : %(module)s : " +
"%(funcName)s : line: %(lineno)d\n" +
"\tprocess details : %(process)d, %(processName)s\n" +
"\tthread details : %(thread)d, %(threadName)s\n" +
"\t%(levelname)s : %(message)s",
"datefmt": "%Y-%m-%d %H:%M:%S"
}
}
}
dictConfig(log_config)
configure_logging(log_level)
# log the cmd line arguments at the debug level
logger.debug(sys.argv)
logger.debug(str(args))
Expand Down
19 changes: 8 additions & 11 deletions src/isocomp/utils/configure_logging.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,15 @@ def configure_logging(level=logging.INFO,
>>> configure_logging(level=logging.DEBUG)
>>> configure_logging(level=logging.INFO)
"""
if level not in [logging.DEBUG,
logging.INFO,
logging.WARNING,
logging.ERROR,
logging.CRITICAL]:
raise ValueError("The logging level must be one of logging.DEBUG, "
"logging.INFO, logging.WARNING, logging.ERROR, "
"or logging.CRITICAL.")

log_level = level.upper()
if log_level not in ['CRITICAL', 'ERROR', 'WARNING', 'INFO', 'DEBUG']:
raise ValueError("The logging level must be one of debug, "
"info, warning, error, "
"or critical.")

if not isinstance(to_file, bool):
raise ValueError("to_file must be a boolean.")

if to_file:
if not filename:
raise ValueError("filename must be provided when to_file is True.")
Expand Down Expand Up @@ -69,7 +66,7 @@ def configure_logging(level=logging.INFO,
'handlers': handlers,
'root': {
'handlers': list(handlers.keys()),
'level': level,
'level': log_level,
},
}

Expand Down

0 comments on commit e81dd43

Please sign in to comment.