Install & Compatibility
Where this runs
tested against v2024.24.12 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslpy 3.10–3.920 runs
installs and imports cleanly · install 0.0s · import 0.000s · 17.8MB
glibcpy 3.10–3.920 runs
installs and imports cleanly · install 1.5s · import 0.000s · 18MB
16MB installed
● package 16MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
Flake8 Plugin Availability
✓ Install 'flake8-logging-format' and run 'flake8'.
This library is a Flake8 plugin and is not imported directly into Python code. Its functionality is automatically enabled when 'flake8' is run after installation, extending Flake8's linting capabilities.
This example demonstrates how `flake8-logging-format` catches common errors in logging calls. After installing the plugin, save the code as `main.py` and run `flake8 main.py` from your terminal. The plugin will automatically identify issues like argument count mismatches or type discrepancies based on format specifiers.
import logging
# Configure a basic logger for demonstration
logging.basicConfig(level=logging.INFO)
def process_user(user_id, username):
logging.info("Processing user: %s (ID: %d)", username, user_id) # Correct usage
logging.warning("User with ID %s did something questionable", user_id) # LGA001: %s expects str, but user_id is int
logging.error("Failed operation on user %s", username, user_id) # LGA001: too many args (expected 1 for %s, got 2)
logging.info("Data: %s %s", "value1") # LGA001: too few args (expected 2 for %s %s, got 1)
# Example usage to trigger the logging calls (output is to console, but errors caught by flake8)
process_user(123, "john.doe")
# To run this with flake8-logging-format, save it as `main.py` and run:
# pip install flake8 flake8-logging-format
# flake8 main.py
#
# Expected output for `flake8 main.py`:
# main.py:8:5: LGA001 Format string argument count mismatch: '%s' for 'user_id' expects str, but got int.
# main.py:9:5: LGA001 Format string argument count mismatch: '%s' for 'username' expects 1 argument, but 2 were given.
# main.py:10:5: LGA001 Format string argument count mismatch: '%s %s' for 'value1' expects 2 arguments, but 1 was given.
Upgrade
Version history
2024.24.12latest on PyPI · released Jun 11, 2024
Audit
Dependencies
flake8requiredThis library is a plugin for Flake8 and requires it to function.