patch logging module to accept PEP-3101 formatting syntax
Project description
logging_unterpolation is a very simple module that will patch the built-in logging module to accept PEP-3101 compliant string formatting (using the str.format method) as well as falling back to accept the original string interpolation operator (% or ‘modulo’)
Here’s a basic example:
>>> import logging >>> from logging_unterpolation import patch_logging >>> logging.basicConfig(level=logging.DEBUG) >>> logging.debug('test') DEBUG:root:test >>> logging.debug('%s', 'test') # example of built-in string interpolation in log messages DEBUG:root:test >>> patch_logging() >>> logging.debug('{0}', 'test') # format syntax not supported unless patched DEBUG:root:test
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file logging_unterpolation-0.2.0.tar.gz
.
File metadata
- Download URL: logging_unterpolation-0.2.0.tar.gz
- Upload date:
- Size: 5.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8bca6fb1aca94568d8f6a9b104bc057d09397a3f3c780b65a26c445c1446ebed |
|
MD5 | d0d4de0763be1a1cf044e7ddcce8e1a8 |
|
BLAKE2b-256 | ac678d5057b171de77c81b48705ab0dcc7a9fcdd3118e169a5b94839da8cb145 |