Skip to main content

Convert logger f-strings and str.format syntax to printf-style strings

Project description

logo

printf-log-formatter

Automatically convert f-strings and str.format() syntax to printf style strings.

In other words,

logger.error(f"{1}")
logger.error("{}".format(1))
logger.error("{foo}".format(foo=1))

is changed to

logger.error("%s", 1)
logger.error("%s", 1)
logger.error("%s", 1)

Motivation

This article explains it well.

tl;dr: It fixes Sentry log integration issues.

Installation

Install with pre-commit, using:

- repo: https://github.com/sondrelg/printf-log-formatter
  rev: v0.1.0
  hooks:
    - id: printf-log-formatter
      args:
        - --log-level=error
        - --quotes=single  # or double

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

printf_log_formatter-0.2.0-py3-none-win_amd64.whl (1.6 MB view details)

Uploaded Python 3 Windows x86-64

printf_log_formatter-0.2.0-py3-none-win32.whl (1.5 MB view details)

Uploaded Python 3 Windows x86

printf_log_formatter-0.2.0-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (2.7 MB view details)

Uploaded Python 3 manylinux: glibc 2.17+ x86-64

printf_log_formatter-0.2.0-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl (2.9 MB view details)

Uploaded Python 3 manylinux: glibc 2.17+ s390x

printf_log_formatter-0.2.0-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl (3.0 MB view details)

Uploaded Python 3 manylinux: glibc 2.17+ ppc64le

printf_log_formatter-0.2.0-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl (2.9 MB view details)

Uploaded Python 3 manylinux: glibc 2.17+ i686

printf_log_formatter-0.2.0-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl (2.7 MB view details)

Uploaded Python 3 manylinux: glibc 2.17+ ARMv7l

printf_log_formatter-0.2.0-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (2.7 MB view details)

Uploaded Python 3 manylinux: glibc 2.17+ ARM64

printf_log_formatter-0.2.0-py3-none-macosx_11_0_arm64.whl (1.6 MB view details)

Uploaded Python 3 macOS 11.0+ ARM64

printf_log_formatter-0.2.0-py3-none-macosx_10_7_x86_64.whl (1.7 MB view details)

Uploaded Python 3 macOS 10.7+ x86-64

File details

Details for the file printf_log_formatter-0.2.0-py3-none-win_amd64.whl.

File metadata

File hashes

Hashes for printf_log_formatter-0.2.0-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 c87f9ed97d4cfa1a72ecef1cc85e69a8cae6282be703607d07357211d5782009
MD5 6e55911bc2e6081a8098d2561a3662f4
BLAKE2b-256 d2f12e02b8e5b18dd044bbee537d315deabc1b6debadb21373724ade65b40c90

See more details on using hashes here.

File details

Details for the file printf_log_formatter-0.2.0-py3-none-win32.whl.

File metadata

File hashes

Hashes for printf_log_formatter-0.2.0-py3-none-win32.whl
Algorithm Hash digest
SHA256 aa85d2bd459a825f009cb95b3977c33086a5df419c24d5ce7ec076c386f2f952
MD5 16e729f88895e684d63b2162849c73d9
BLAKE2b-256 687442c7d21b624c13de948b5ad277a260afc5fd5c3d82b2fcf3075b82241380

See more details on using hashes here.

File details

Details for the file printf_log_formatter-0.2.0-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for printf_log_formatter-0.2.0-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 afadada5426f55447b7b0b001722c490a5cec17fe8dd5d6391bf3faf8d0de6eb
MD5 653d9fe875b6574b1edf3720cf057ba2
BLAKE2b-256 b5b651ccb64a3786c8e7a26349fc971d4678536e04084a7d6d06069c62acf7a3

See more details on using hashes here.

File details

Details for the file printf_log_formatter-0.2.0-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl.

File metadata

File hashes

Hashes for printf_log_formatter-0.2.0-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl
Algorithm Hash digest
SHA256 6ed7c77354585256b1ba652aad1f6bb3e7bd9ce772edf18bf9871cbadd467d2d
MD5 d252657fc7146b43a689b3ad31b08a64
BLAKE2b-256 1e7df2bddee6095f1b9857e7260522ba464dcb44482cf0232b01d5b4d84092b9

See more details on using hashes here.

File details

Details for the file printf_log_formatter-0.2.0-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl.

File metadata

File hashes

Hashes for printf_log_formatter-0.2.0-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
Algorithm Hash digest
SHA256 2365a9904053934e6269006fcd13df10433da8a49e3f8086620625140338b964
MD5 cc639e1aebf145a789692cdd28da24b8
BLAKE2b-256 52d294388bbe9ef6b2b276a080eb20285099f51557ae7f06c14bb4b5a3a8fec0

See more details on using hashes here.

File details

Details for the file printf_log_formatter-0.2.0-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl.

File metadata

File hashes

Hashes for printf_log_formatter-0.2.0-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 631f64b818e7bf12dff3c452dd7f6df8614c8287d20cbbd9852243cb3e6bbe0f
MD5 8d562a955ef70e55e3dbc0644b009ca0
BLAKE2b-256 880ef77d3c48a28d0a4f0ffb3adf5d3d3e09115fd728352e454e7bc73388bbd9

See more details on using hashes here.

File details

Details for the file printf_log_formatter-0.2.0-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl.

File metadata

File hashes

Hashes for printf_log_formatter-0.2.0-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
Algorithm Hash digest
SHA256 5811f1faefea27e3dd502cbee83330104b865bc98fcf14288a033c6c2e184667
MD5 fdf673c8760e2e4e27690a8a38598a2e
BLAKE2b-256 88231a33354306843e7c9f3af62d705620a0c748bec0020b64ed7284a9bf0767

See more details on using hashes here.

File details

Details for the file printf_log_formatter-0.2.0-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for printf_log_formatter-0.2.0-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 f7495b6670586a23773abb9355100709e2213d4fa0b145eac039e773f53f5f1c
MD5 541f6fccd97595b70feb319dc3fc3509
BLAKE2b-256 3d61f707eb57c5fd61b9d91c0c6ace4cd2dea040c9227834b2c789f4a42ce515

See more details on using hashes here.

File details

Details for the file printf_log_formatter-0.2.0-py3-none-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for printf_log_formatter-0.2.0-py3-none-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 05dd0eb57ece58f9a3b908df0dd45be74fb89a2dd699527e3e2d2c64be50a3dc
MD5 0663c4622dddc6298e312d1f0a279150
BLAKE2b-256 9d7b347ac22f3d8d2c7ef4acda3815f08ca45019496ee0b832cb706e9aee4d6b

See more details on using hashes here.

File details

Details for the file printf_log_formatter-0.2.0-py3-none-macosx_10_7_x86_64.whl.

File metadata

File hashes

Hashes for printf_log_formatter-0.2.0-py3-none-macosx_10_7_x86_64.whl
Algorithm Hash digest
SHA256 18983191eff7870b1e492b0ce6a7f050c2bd5e935482fa19362ba980e0ed9bb9
MD5 b14bf061aaeb46bee4744f4428582ddb
BLAKE2b-256 900e7d1cb60e2b17e5bf3df1baf5c41f5bd24fa30b0965068a2e0a1d6eea3d7f

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page