# Logging

Logging conveys what your code is doing while it is running. It keeps track of progress and can help diagnose issues or bugs when they arise. 

## Description 

Insert logging statements in your code at important progress points for printing either to the screen or to a file. Logging at the beginning of code can display settings being used that impact the output. Logging at transition points such as loop iterations keeps track of how much has been processed. Logging before and/or after complex code sequences can help diagnose issues if/when the code breaks. 

Use a logging package with a hierarchical approach to control the level of detail that is logged by changing a single setting. Use of a logging package can also quickly change the format of logs for better human or machine readability. 

## Resources

### Language Resources

#### Python
* Tutorial: https://builtin.com/software-engineering-perspectives/python-logging
* [logging module](https://docs.python.org/3/library/logging.html)
* [logging cookbook](https://docs.python.org/3/howto/logging-cookbook.html#logging-cookbook) - good how-to-use logging module

#### R
* [lgr package](https://cran.r-project.org/web/packages/lgr/vignettes/lgr.html)

