printf-log-formatter
Automatically convert f-strings and str.format() syntax to printf-style strings.
In other words, this syntax
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
Why would we want to do this? This article explains it pretty well.
Mainly it's useful for Python projects using Sentry's log integration.
Installation
You have two options for running this pre-commit hook:
Python hook
If you would like to install this using Python, run:
pip install printf-log-formatter
then set the pre-commit hook up using:
- repo: local
hooks:
- id: printf-log-formatter
name: printf-log-formatter
entry: printf-log-formatter
language: system
types: [ python ]
args:
- --log-level=error
Rust hook
If you're happy to compile the Rust version, you can use:
- repo: https://github.com/sondrelg/printf-log-formatter
rev: ''
hooks:
- id: printf-log-formatter
args:
- --log-level=error
I just want to downgrade loggers once
The Rust binary or Python package can also be run directly, like this:
printf-log-formatter $(find . -name "*.py") --log-level error
Metadata
Release files for printf-log-formatter 0.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distributions (wheels)
Total release size: 23.2 MB
Release files / printf_log_formatter-0.3.0-py3-none-win_amd64.whl
| Download URL | printf_log_formatter-0.3.0-py3-none-win_amd64.whl |
|---|---|
| Size | 1.6 MB |
| Tags | Python 3 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
27c3f053166bfe74e490661e8fe47167b12b8ca4d3066ba13f1ab53d1c7c6788
|
|
BLAKE2b-256 checksum How to use checksums |
f35f22d83a59f2aa7201179d73eacc26ab10846d1e47933d75480e123b1bcf83
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/0.14.17
|
Release files / printf_log_formatter-0.3.0-py3-none-win32.whl
| Download URL | printf_log_formatter-0.3.0-py3-none-win32.whl |
|---|---|
| Size | 1.5 MB |
| Tags | Python 3 Windows x86-32 |
|
SHA-256 checksum How to use checksums |
d2fc29f8776121c1477100287c285d4798d310d0547f4573ad3eae23b66549cc
|
|
BLAKE2b-256 checksum How to use checksums |
ff7fde892947e6860caf2f9fb1185006722870ebddda2cfdefce4602cd9fa0e2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/0.14.17
|
Release files / printf_log_formatter-0.3.0-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | printf_log_formatter-0.3.0-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 2.7 MB |
| Tags | Linux glibc 2.17+ x86-64 Python 3 |
|
SHA-256 checksum How to use checksums |
97d675c90d84b87ecaa48d867b937876d46c66b0d480bf2bae373738fe8a3d17
|
|
BLAKE2b-256 checksum How to use checksums |
96e15556a067332dbf256e31f93e9bf2c0cd85a3cff6ccf5b2c476bdb51a20df
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/0.14.17
|
Release files / printf_log_formatter-0.3.0-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl
| Download URL | printf_log_formatter-0.3.0-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl |
|---|---|
| Size | 2.9 MB |
| Tags | Linux glibc 2.17+ IBM System/390x Python 3 |
|
SHA-256 checksum How to use checksums |
af414b2e2d5b78504ace2d5b76b8aaae0afbc894314b56be170d8a052ba81388
|
|
BLAKE2b-256 checksum How to use checksums |
bf8e5bd8d4a1a5b209f4de07ad412a47bd7c2cd4fd70d3973657d9bcff6dec34
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/0.14.17
|
Release files / printf_log_formatter-0.3.0-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
| Download URL | printf_log_formatter-0.3.0-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl |
|---|---|
| Size | 3.0 MB |
| Tags | Linux glibc 2.17+ PowerPC 64-le Python 3 |
|
SHA-256 checksum How to use checksums |
d17c0e555ed68249071675f8a86310b251fb84711a1928bfef5d0d14ece2f410
|
|
BLAKE2b-256 checksum How to use checksums |
88d544cfa70266d7ec5498976e9d9ec9765202cadbd1ff798b391bd1157975c4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/0.14.17
|
Release files / printf_log_formatter-0.3.0-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl
| Download URL | printf_log_formatter-0.3.0-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl |
|---|---|
| Size | 2.9 MB |
| Tags | Linux glibc 2.17+ x86-32 Python 3 |
|
SHA-256 checksum How to use checksums |
b7099fa053a3eae2e9594f18712458b90d8008bc5f942f67bb18f9bc351001cd
|
|
BLAKE2b-256 checksum How to use checksums |
b2bc62e5b8e4a8e15b3fcc0a245346f090a0e0a855aaf191dc6c2a62106d1237
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/0.14.17
|
Release files / printf_log_formatter-0.3.0-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
| Download URL | printf_log_formatter-0.3.0-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl |
|---|---|
| Size | 2.7 MB |
| Tags | Linux glibc 2.17+ ARMv7l Python 3 |
|
SHA-256 checksum How to use checksums |
b51bfb73707f47b0dddc215a4660d088be918a250f5040683b724d2a2a9ad4d6
|
|
BLAKE2b-256 checksum How to use checksums |
d784ada8ce24e04ca4142c5ac4726d9ce284df4cf2ffdc505d6716b3ef950d6d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/0.14.17
|
Release files / printf_log_formatter-0.3.0-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
| Download URL | printf_log_formatter-0.3.0-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl |
|---|---|
| Size | 2.7 MB |
| Tags | Linux glibc 2.17+ ARM64 Python 3 |
|
SHA-256 checksum How to use checksums |
300af2cdeafde7e4f0b631d41e82ceb7322a290b8e04c4e4bb35f8334ae9c7e5
|
|
BLAKE2b-256 checksum How to use checksums |
7d12acae1118f9481758d6981808b0183f92ac6228b63cee315eb6c99a390d3f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/0.14.17
|
Release files / printf_log_formatter-0.3.0-py3-none-macosx_11_0_arm64.whl
| Download URL | printf_log_formatter-0.3.0-py3-none-macosx_11_0_arm64.whl |
|---|---|
| Size | 1.6 MB |
| Tags | Python 3 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
c6bb875f2e7ede7467ee59a8f73125cb6361d9b599b8bcf8f9e1f2ca487519ae
|
|
BLAKE2b-256 checksum How to use checksums |
a6a76e4449dffad3d095678c9badf1c487d1bc0ea7bba15ea6058f25f7c550a6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/0.14.17
|
Release files / printf_log_formatter-0.3.0-py3-none-macosx_10_7_x86_64.whl
| Download URL | printf_log_formatter-0.3.0-py3-none-macosx_10_7_x86_64.whl |
|---|---|
| Size | 1.7 MB |
| Tags | Python 3 macOS 10.7+ x86-64 |
|
SHA-256 checksum How to use checksums |
a41bfba0d49dc16675ac9c180c3380903622a4f48d6a537c72394054ed513a35
|
|
BLAKE2b-256 checksum How to use checksums |
e7c989e0cf694ced1721b81a50f7b9265fa7da3ce369833e4065cd2b75bbf22f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/0.14.17
|