Closed mnwhite closed 3 months ago
See discussion in #283
There is a standard and flexible logging
package in Python.
https://docs.python.org/3/howto/logging.html#logging-basic-tutorial
I highly recommend using this standard functionality instead of creating new logging functionality.
Responding to this, which may have been meant for this issue: https://github.com/econ-ark/HARK/issues/283#issuecomment-597810736
The warnings
controls in Python are managed through this package:
https://docs.python.org/3/library/warnings.html
I think we are using the Python logging library now. So maybe it's a good time to revisit this?
Already implemented for ConsIndShockModel, to be extended across HARK.
I think this was handled long ago. Warnings about intended HARK behavior are suppressed.
Since the very first version of HARK, we've had a "monkey patch" to the warnings module to make warnings display in a single line, rather than a big angry chunk of red text (in Spyder). Some recent changes to numpy have increased the number of warnings it throws, for things like dividing by zero or using NaNs basically anywhere. As a bunch of methods in HARK exploit numpy's handling of division by zero (1./0. = np.inf), it's probably a bit worrisome to new users when they see a bunch of "invalid value encountered in divide" messages come up. I would like to turn off these warnings where we know that they're not relevant (because dividing by zero or carrying around some NaNs is our intended functionality), but our current warning format gives no opportunity for traceback.
Our monkey patch needs to evolve into a human patch, roughly speaking. The definition in HARKutilities should be greatly expanded to offer easy options. I'm not sure what's possible, but ideally I would like the option to:
I'm assigning this to Nathan because he wrote the initial warnings patch and knows the most about this.