-
Notifications
You must be signed in to change notification settings - Fork 1
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
Option to redirect log messages to console #17
Comments
I'm pretty sure @tavinathanson set this up by default for cohorts, will likely borrow his implementation |
Here's a way to print to the console from which jupyter notebook is running, rather than to a notebook itself: import sys
print("stdout -- visible only in jupyter notebook", file=sys.stdout)
print("stderr -- visible only in jupyter notebook", file=sys.stderr)
alt_stdout = open('/dev/stdout', 'w')
print("this only shows up in the console", file=alt_stdout) |
I was thinking of adding something like this snippet of code to add a second output stream handler to the logger, depending on the user's preferences. if logger.handlers:
logger.handlers = []
stdout_handler = logging.StreamHandler(sys.stdout)
logger.addHandler(stdout_handler)
logger.setLevel(logging.INFO) You can do this now with Putting these pieces together, it would look something like the following: alt_stdout = open('/dev/stdout', 'w')
stdout_handler = logging.StreamHandler(alt_stdout)
logger.addHandler(stdout_handler) or, stdout_handler = logging.FileHandler('/dev/stdout')
logger.addHandler(stdout_handler) |
When fitting long-running models, it can be helpful to see error messages / warnings produced by stancache in the console.
It would be nice to add this option to the config file so that messages are broadcast more widely, particularly when they involve being unable to save to disk.
The text was updated successfully, but these errors were encountered: