Skip to content
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

refine logging #38

Merged
merged 4 commits into from
Feb 23, 2024
Merged

refine logging #38

merged 4 commits into from
Feb 23, 2024

Conversation

rkaminsk
Copy link
Member

No description provided.

@rkaminsk rkaminsk linked an issue Feb 23, 2024 that may be closed by this pull request
@rkaminsk
Copy link
Member Author

@susuhahnml and @MaxOstrowski: what about the following?

@rkaminsk rkaminsk merged commit 6bc2ceb into master Feb 23, 2024
3 checks passed
@rkaminsk rkaminsk deleted the feature/logging branch February 23, 2024 17:08
@MaxOstrowski
Copy link
Member

@rkaminsk @susuhahnml @sthiele maybe the review got lost as it seems it got added after the issue was closed. But the remarks seem to be lost now.
As the issue was also closed (and I miss the rights to reopen it) maybe I can get your quick opinion about my questions here ?

@rkaminsk
Copy link
Member Author

Do you mean the questions in #25? I tried to address them here. If you think that there should be further changes, you could open a new PR. The goal was to get some color in for simple command line applications (because this is not completely trivial) and not to interfere at all in the case of libraries. The logger can now be used exactly as you suggest in this setting.

@MaxOstrowski
Copy link
Member

No. I'm not sure if this is visible to you, might had some problems with my github App on Android. There was a review to the PR with some simple questions:

NOTSET = logging.NOTSET
...

Why do we redefine these values ?

def get_logger(name: str) -> logging.Logger:

Why do we redefine this function ?

# nocoverage

We should add some tests.

I will just propose a PR this week and we can continue the discussion there.

@rkaminsk
Copy link
Member Author

Somehow, I did not even get an email for this.

No. I'm not sure if this is visible to you, might had some problems with my github App on Android. There was a review to the PR with some simple questions:

NOTSET = logging.NOTSET
...

Why do we redefine these values ?

To avoid having to import two modules. The idea was to expose a minimal interface to do logging. For my use cases in the past it was enough to have one function/object to log plus the levels. This might turn out to be insufficient for complex cases.

def get_logger(name: str) -> logging.Logger:

Same as above plus the getLogger function from python's default module is old and ugly. It does not even follow python's recommended naming scheme.

Why do we redefine this function ?

# nocoverage

We should add some tests.

This is difficult to test because (I think that) by design, the logger setup should only run once and then cannot be changed.

If you don't like the reexporting, you can also just import the configure function and use the logging module directly. Or maybe you even want to extend the module to add more functions to do logging as required by your application.

@MaxOstrowski
Copy link
Member

Thanks for answering. Makes your design decisions more relatable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

logger.py and parser.py update
2 participants