hAMRonization icon indicating copy to clipboard operation
hAMRonization copied to clipboard

Implementing logging and debug flag to simplify exception messages

Open fmaguire opened this issue 4 years ago • 2 comments

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.

  1. Add boolean debug flag in the generic CLI parser (default False): https://github.com/pha4ge/hAMRonization/blob/master/hAMRonization/Interfaces.py#L217

  2. 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)

  3. Add wrong input file exception using logging library, specifically add try: and except 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.

  4. Update the validation of input fields exception at https://github.com/pha4ge/hAMRonization/blob/master/hAMRonization/hAMRonizedResult.py#L57 to use logging + debug

fmaguire avatar Mar 23 '21 15:03 fmaguire

Seems like a very good and feasable idea. Need any help with that?

cimendes avatar Mar 24 '21 14:03 cimendes

Thought it might make a nice little project for someone with more spare time which probably doesn't include you right now!

fmaguire avatar Mar 24 '21 14:03 fmaguire