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

Move root logger config to CLI module #28

Merged
merged 2 commits into from
Nov 19, 2021
Merged

Conversation

benthorner
Copy link
Contributor

Fixes: #27.

This ensures the root logger is only configured when
this package is used as a command.

I've also added an extra commit to support local dev -
happy to learn if there's a way of doing it already.

@avaldebe avaldebe added the enhancement New feature or request label Nov 18, 2021
Previously we configured the root logger in the PMS package itself,
which would mean any code using the package as a library would get
the logging config as a side effect.

Rather than configure the root logger, which should be left to the
toplevel program, this re-scopes how we set the config to apply to
just the specific logger for the package.
This follows the convention for typer prorams. Note the same can
also be achieved with e.g.

        python -c 'from pms.cli import main; main()'

but having it run automatically saves documenting this.
@avaldebe avaldebe merged commit 7dafee9 into avaldebe:master Nov 19, 2021
@avaldebe
Copy link
Owner

@benthorner

1e6 thanks for your contributtion

@benthorner
Copy link
Contributor Author

@avaldebe thanks for the speedy review!

Could you release the new version to PyPI?

@avaldebe
Copy link
Owner

done

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

Successfully merging this pull request may close these issues.

logging.basicConfig() conflicts with use as a library
2 participants