-
-
Notifications
You must be signed in to change notification settings - Fork 199
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
make HARK less "verbose" -- introduce logger #701
Conversation
I probably missed this conversation regarding this but shouldn't import HARK.logger as logger be used in ConsIndShockModel.py? Users should use something like
instead of creating a "global" loggers while creating an example/notebook? |
@MridulS No, I don't think so. In this, PR, ConsIndShockModel.py imports This effectively puts the logging module, which is a Python standard library, as an intermediary between these statements and STERR. (With a little more sophisticated tuning, it could pipe these messages to STOUT, but this is the simplest implementation currently.) This is done "globally" because that's the simplest implementation. If we needed something more complex, we could do it. But that would require more expressing logging configuration. I think it's not smart to have verbosity be a model parameter. Logging configuration should be done at the global level because really it's a configuration of the Python environment's I/O. Specifically, the O. Trying to patch it through the program logic creates a lot of messy interaction between model, controller, and view logic. It's harder to maintain and makes it difficult to give the user the ability to turn verbosity on or off. |
I'll add the logger to the init file as per this PR from Mridul |
In the latest commit to this PR, the logging configuration is moved to For library code, the HARK logger needs to be invoked explicitly. I.e.:
The HARK user does not need to do anything extra to run this code! This is good. However: in the current PR:
This means that for the current PR, the user will automatically see the checkConditions() messages. This looks like a difference of opinion between @mnwhite and @llorracc and I defer to their consensus on the final implementation. |
I need to check the boolean flags for verbosity the default dictionaries; there is no disagreement otherwise. |
This is superseded by #714 |
…with variable configuration levels. Fixes #283
The way you can change the verbosity level at the top of a notebook is now, e.g.:
or
I've shown this at the top of one of the example notebooks to demonstrate.
This PR so far only introduces the logger's functionality for the PerfForesightConsumerType and IndShockConsumerType, which have implemented checkConditions() methods.
If the design passes review, I can change other print statements to logging.info statements.