Consistent logging errors and warnings
- Dominant language
- Python
- Stars
- 9
- Forks
- 9
- Avg merge
- 12d 12h
- Merged PRs (30d)
- 2
Description
Currently errors and warnings are recorded in different ways:
(1) using logger
(2) warnings.warn
(3) print statements
Print statements would not go into the `log.txt` file generated by FAB, therefore resulting in losing error or warning information for debugging. An example of this is: https://github.com/hiker/fab_new/blob/282f068420577e9b6065fd086cc879124c1d86ba/source/fab/steps/analyse.py#L268C9-L268C15 I once had this error because of not having clang available for c file analysis. However, this error did not get into the `log.txt` file. The reported error in the `log.txt` file is key error of lookup in
https://github.com/MetOffice/fab/blob/282f068420577e9b6065fd086cc879124c1d86ba/source/fab/mo.py#L37.
It was not obvious to me at first instinct that this key error was due to the analysis failure earlier. I had to go through some extensive debugging steps locally to find this out.
It would be good if the error and warning logging can be consistent with using logger.
Contributor guide
Research direction
Start by inspecting the print or warning example in source/fab/steps/analyse.py and the related lookup in source/fab/mo.py. Trace how FAB writes log.txt and identify the other error and warning paths that use different mechanisms. Done means relevant errors and warnings are consistently recorded in the FAB log.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- build-system, tooling
- Issue type
- Refactor
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100