Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Support python 3.14 Template Strings #1397

Copy link
Copy link
@TurtleOrangina

Description

@TurtleOrangina
Issue body actions

Writing

logger.debug(f"Expensive/large object = {obj}")

Is not ideal for performance reasons due to the eager evaluation of the format string (see https://docs.astral.sh/ruff/rules/logging-f-string/ for a more thorough explanation).

This is why loguru has implemented its own formatting via parameters. The README states:

### Modern string formatting using braces style

Loguru favors the much more elegant and powerful `{}` formatting over `%`, logging functions are actually equivalent to `str.format()`.

`logger.info("If you're using Python {}, prefer {feature} of course!", 3.6, feature="f-strings")`

With Python 3.14, we can provide the same functionality, by supporting Template Strings. The above example from the readme could then read:

version = 3.14
feature = "t-strings"
logger.info(t"If you're using Python {version}, prefer {feature} of course!")

Metadata

Metadata

Assignees

No one assigned

    Labels

    featureRequest for adding a new featureRequest for adding a new feature

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.