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

Introduce qualified name instead of function name in logging #128688

Open
NN--- opened this issue Jan 9, 2025 · 0 comments
Open

Introduce qualified name instead of function name in logging #128688

NN--- opened this issue Jan 9, 2025 · 0 comments
Labels
type-feature A feature request or enhancement

Comments

@NN---
Copy link

NN--- commented Jan 9, 2025

Feature or enhancement

Proposal:

class A:
  def f():
    logger = logging.getLogger("a")
    logger.use_qualname = True

    formatter = logging.Formatter("%(funcName)s - %(message)s")
        
    handler.setFormatter(formatter)
    logger.addHandler(handler)
    logger.setLevel(logging.INFO)

    logger.info("abc")

Result will include classname and not just function.

Has this already been discussed elsewhere?

I have already discussed this feature proposal on Discourse

Links to previous discussion of this feature:

https://discuss.python.org/t/add-ability-to-log-qualified-name-in-logging-package/76560

Linked PRs

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

No branches or pull requests

1 participant