-
Notifications
You must be signed in to change notification settings - Fork 15
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 console module #1948
Add console module #1948
Conversation
I agree that logging and writing to console are distinct actions, but I was wondering whether there's a sufficiently broad module name that could cover them both. They're more similar to one another than e.g. logging is to deploying Pulumi infrastructure. What do you think @JimMadge? |
I don't like the idea of both in a module at the same level, like |
I guess I was imagining something like:
to replace
Not a big difference, but might make the code a bit easier to understand for new developers. |
Coverage reportClick to see where and how coverage changed
This report was generated by python-coverage-comment-action |
I also should add tests for the parts that aren't covered given that I have had a look at them here. |
@jemrobinson I'm still not keen on collecting logging and printing in one module. Would something like from data_safe_haven.logging import get_logger
from data_safe_haven.console import console, prompts
logger = get_logger()
logger.info("hello")
console.print("hello") # console is a rich.console.Console
prompts.confirm("yes or no?") be better? |
I think that looks OK (did you mean to import N.B. I don't mean that we need |
Oh, I made a mistake, I've updated the code block. |
OK, what do you think of: from data_safe_haven.logging import get_logger
from data_safe_haven.console import console
logger = get_logger()
logger.info("hello")
console.print("hello")
console.confirm("yes or no?") instead? |
Yes we can do that. The only thing that is a little annoying about that is we are making a wrapper for |
I agree, it's a bit annoying - maybe we can use this chance to provide an adaptor for the |
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.
LGTM. Does it work? :)
Yes, as far as I can tell. I'm still not sure what is happening in #1954. I can't reproduce it with |
Closes #1945