-
Notifications
You must be signed in to change notification settings - Fork 99
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
Add logger.info to beginning and end of each function #838
Comments
Hi @jgostick, I can give it a try |
Wow, that would be phenomenally helpful. Do you need help with the git fork / pull request process? As for implementation, there are only a few things to think about:
import logging
# Some other imports
logger = logging.getLogger(__name__)
logger.info("Start of <function name>")
# slow code here
logger.info("Enf of <function name>") It is possible to get the function from which the logger is being called using the Anyway, I really appreaciate the offer to help and happy to give you more guidance if needed, just let me know. |
You can see an example here |
Thanks @jgostick |
Hey @jgostick , I complete the task |
The logger outputs the time it writes, so this can be used to get a rough idea of how long a function takes by setting loglevel to 2, then just looking at the before/after of the logger message. I'm running some jupyter notebooks and curious to know how long various functions take for large iamges, so find myself wishing I could just set the loglevel to info to get this.
The text was updated successfully, but these errors were encountered: