do not use format string with logging functions

This page is not yet available in Spanish. We are working on its translation.
If you have any questions or feedback about our current translation project, feel free to reach out to us!

Metadata

ID: python-best-practices/logging-no-format

Language: Python

Severity: Notice

Category: Best Practices

Description

Avoid using format string with the format method when logging information.

Non-Compliant Code Examples

import logging
import shlex

logging.info("error {0} {1}".format(plop, plip))  # use instead logging.info("error %s", plop)

Compliant Code Examples

import logging

logging.info("wfwef")
https://static.datadoghq.com/static/images/logos/github_avatar.svg https://static.datadoghq.com/static/images/logos/vscode_avatar.svg jetbrains

Seamless integrations. Try Datadog Code Analysis

PREVIEWING: rtrieu/product-analytics-ui-changes