Skip to content

Introduce qualified name instead of function name in logging #128688

@NN---

Description

@NN---

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    stdlibStandard Library Python modules in the Lib/ directorytype-featureA feature request or enhancement

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions