A pre-commit script to make log lines lazzier
Project description
Lazy log formatter
Pre-commit hook to automatically detect and convert f-strings in Python code used in log calls to lazy log calls, following W1203 Pylint rule:
Usage
To use with pre-commit, add the following to your .pre-commit-config.yaml
:
- repo: https://github.com/dmar1n/lazy-log-formatter
rev: 0.4.1
hooks:
- id: lazy-log-formatter
args: ['--fix']
Options
--fix
: Automatically fix f-strings used in log calls to lazy log calls.
Examples
If the --fix
option is used, the hook will convert f-strings in log calls to lazy log calls, as follows:
# Before
logger.info(f'Hello {name}')
# After
logger.info('Hello %s', name)
# Before
logger.info(f'Hello {name} {surname}')
# After
logger.info('Hello %s %s', name, surname)
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
Built Distribution
File details
Details for the file lazy_log_formatter-0.4.1.tar.gz
.
File metadata
- Download URL: lazy_log_formatter-0.4.1.tar.gz
- Upload date:
- Size: 7.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f1f292310dc7969a1e61aa810f0127c312a7beb377fe9837970538c25f1c7ad1 |
|
MD5 | e21bf09494ade4965f63ea669567d9bd |
|
BLAKE2b-256 | c9a78bcb623683e11d4680dffbd29edb5b8e27567ab6d3ca071f396fe7288035 |
Provenance
The following attestation bundles were made for lazy_log_formatter-0.4.1.tar.gz
:
Publisher:
release.yaml
on dmar1n/lazy-log-formatter
-
Statement type:
https://in-toto.io/Statement/v1
- Predicate type:
https://docs.pypi.org/attestations/publish/v1
- Subject name:
lazy_log_formatter-0.4.1.tar.gz
- Subject digest:
f1f292310dc7969a1e61aa810f0127c312a7beb377fe9837970538c25f1c7ad1
- Sigstore transparency entry: 145935364
- Sigstore integration time:
- Predicate type:
File details
Details for the file lazy_log_formatter-0.4.1-py3-none-any.whl
.
File metadata
- Download URL: lazy_log_formatter-0.4.1-py3-none-any.whl
- Upload date:
- Size: 8.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a752b8606039d19de3b7916e3449bcd58dc0f99456f5bfc12810085fe4e1fba2 |
|
MD5 | d4499d760fb2fa067fd1f8c6adebbc8c |
|
BLAKE2b-256 | 888951073a48a87fa7bba125a9eef0a12b0bead2d93ed86b7f90043a295364f3 |
Provenance
The following attestation bundles were made for lazy_log_formatter-0.4.1-py3-none-any.whl
:
Publisher:
release.yaml
on dmar1n/lazy-log-formatter
-
Statement type:
https://in-toto.io/Statement/v1
- Predicate type:
https://docs.pypi.org/attestations/publish/v1
- Subject name:
lazy_log_formatter-0.4.1-py3-none-any.whl
- Subject digest:
a752b8606039d19de3b7916e3449bcd58dc0f99456f5bfc12810085fe4e1fba2
- Sigstore transparency entry: 145935366
- Sigstore integration time:
- Predicate type: