Convert logger f-strings and str.format syntax to printf-style strings
Project description
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 Distribution
printf_log_formatter-0.1.0.tar.gz
(26.7 kB
view hashes)
Built Distribution
Close
Hashes for printf_log_formatter-0.1.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 95d9275aedc8dfbfde6e65aebb7d38bf6bcc0cc4d85ed20b6ce2ff01bd463e6d |
|
MD5 | c8d5aab2a7b9a53483c6706eddd2c0b5 |
|
BLAKE2b-256 | f265fe6a28f40954e37b43a06c8e92237ee9ca3c63c22f5975364b67699f3842 |
Close
Hashes for printf_log_formatter-0.1.0-cp310-cp310-manylinux_2_34_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 386db7cf1b8851910fe64a3e938144abc9304a633bdf210049f0f7e6ffc181aa |
|
MD5 | a05d10a552084d4df1358d351c776f94 |
|
BLAKE2b-256 | f7079e80577fc7b02f67310e10183dff4fae08d1a2f1780e9dbe5fb845997995 |