Implementing logging and debug flag to simplify exception messages
To handle concerns raised by @cimendes in #39 and try and make issues with input selection clearer to users e.g., #54 we should add proper use of logging library, default to simple error messages and add a --debug flag to argparse which displays the full traceback.
-
Add boolean debug flag in the generic CLI parser (default False): https://github.com/pha4ge/hAMRonization/blob/master/hAMRonization/Interfaces.py#L217
-
Set up the logging levels based on
args.debug: https://github.com/pha4ge/hAMRonization/blob/master/hAMRonization/Interfaces.py#L257 (e.g., https://stackoverflow.com/questions/14097061/easier-way-to-enable-verbose-logging) -
Add wrong input file exception using logging library, specifically add
try:andexcept KeyError:at https://github.com/pha4ge/hAMRonization/blob/master/hAMRonization/Interfaces.py#L66 that explains to the user that expected input columns can't be found and to check if they are using the correct AMR prediction file. -
Update the validation of input fields exception at https://github.com/pha4ge/hAMRonization/blob/master/hAMRonization/hAMRonizedResult.py#L57 to use logging + debug
Seems like a very good and feasable idea. Need any help with that?
Thought it might make a nice little project for someone with more spare time which probably doesn't include you right now!