do not use format string with logging functions

このページは日本語には対応しておりません。随時翻訳に取り組んでいます。翻訳に関してご質問やご意見ございましたら、お気軽にご連絡ください。

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