-
Notifications
You must be signed in to change notification settings - Fork 93
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
Configure logging with support for verbose flags #391
base: pymbar4
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a way we can make this a bit more concise? As it is, it doubles the number of lines to add a comment, which adds significant code length with just duplicate lines? Maybe there can be a wrapper function in utils that wraps this, so one can just give the comment and the level? (maybe that gets in the way of the use of name)?
That's a good point. I think I can come up with something... The However, I think we could wrap up this logic in a nicer way. Some quick ideas, let me know which one you like more: # A
with emit_if_verbose(__name__, verbose=verbose):
logger.info("Something something")
# B
logger.log("Something something", level=logging.INFO, force_emit=verbose) I tend to prefer |
I think I prefer the second? I think the second part is to document somewhere how people ask for emission of the other levels. |
…des levels for that message
Let me know what you think about it. It's a bit hacky, but hopefully not too much :) My only concern is what happens when |
Anything else needed for this? |
Ideally, some manual testing, to see if the logging machinery behaves the way a user would expect. I did a couple of quick ones with the examples and was successful, but I'd like more feedback if possible. |
@mrshirts anything else you want to add here? |
This is needs some more testing in real world conditions, ideally in a notebook or somewhere where you are using other libraries at the same time. Does anybody have a good example? |
My one question with this, is there a reason you cannot add a different level for verbosity? Since |
The one thing that I want to make sure of is it's very clear to users in the documentation how to make a given function call verbose. |
Addresses #379