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

Simpler logging setup from Python #503

Open
BatmanAoD opened this issue Oct 4, 2024 · 0 comments
Open

Simpler logging setup from Python #503

BatmanAoD opened this issue Oct 4, 2024 · 0 comments

Comments

@BatmanAoD
Copy link
Contributor

The logging configuration from Python is fairly unwieldy; for instance, this seems to be the simplest way to enable logs that include the job ID:

import logging
logging.basicConfig(level=logging.DEBUG)

class QCSLogFilter(logging.Filter):
    def filter(self, record) -> bool:
        return "qcs.qpu.api" in record.name

for handler in logging.root.handlers:
    handler.addFilter(QCSLogFilter())

It would be nice for the Python SDK package to provide a small number of functions to enable some common logging configurations such as the above, without the kludge of applying a global filter to all logging handlers.

@BatmanAoD BatmanAoD changed the title Simple logging setup from Python Simpler logging setup from Python Oct 4, 2024
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

No branches or pull requests

1 participant