structlog-configfile
Helpers to configure structlog together with standard-library logging from a small configuration module.
Installation
pip install structlog-configfile
Quick start
Replace the standard structlog logger factory with the package helper:
import structlog_configfile
logger = structlog_configfile.get_logger()
logger.info("hello", user="alice")
This loads the built-in defaults and configures both structlog and stdlib logging.
Using a custom configuration file
You can point the helper at your own Python configuration module:
import structlog_configfile
logger = structlog_configfile.get_logger(config_file="path/to/my_config.py" [, struct_log_logger_args])
Using a custom configuration file
You can point the helper at your own Python configuration module:
import custom_module.logging.config
logger = structlog_configfile.get_logger(config_file=custom_module.logging.config [, struct_log_logger_args])
You can also set the environment variable STRUCTLOG_CONFIG_FILE to avoid passing the path explicitly.
Example configuration module:
from pathlib import Path
import structlog
logging_config_file = Path(__file__).parent.joinpath("logging.yaml")
pre_process_processors = [
structlog.processors.TimeStamper(fmt="iso"),
]
structlog_processors = []
logging_processors = []
post_process_processors = []
renderer = structlog.processors.JSONRenderer()
handleStdlib = True
Supported configuration knobs
The configuration module can define the following values:
logging_config_file: path to the stdlib logging configuration file (https://docs.python.org/3/library/logging.config.html)pre_process_processors: processors applied before other processorsstructlog_processors: processors used for structlog logslogging_processors: processors used for stdlib loggingpost_process_processors: processors applied after all othersrenderer: the final renderer used by the logging formatterstdlib_preprocessor: processors for stdlib log preparationstdlib_processor: processors for stdlib log handlingstdlib_postprocessor: processors applied after stdlib processingembeds_std_lib: enable or disable stdlib logging setup
Logging configuration file formats
The file referenced by logging_config_file can be a Jinja template or a YAML, JSON, or TOML file. The package will load it and use it for stdlib logging configuration.
Notes
The package exposes both get_logger() and getLoger() for compatibility.
Metadata
Release files for structlog-configfile 1.1.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| structlog_configfile-1.1.5.tar.gz | 7.1 kB | Without provenance | Details for structlog_configfile-1.1.5.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| structlog_configfile-1.1.5-py3-none-any.whl | Python 3 | none | any | Details for structlog_configfile-1.1.5-py3-none-any.whl |
Total release size: 17.7 kB
Release files / structlog_configfile-1.1.5.tar.gz
| Download URL | structlog_configfile-1.1.5.tar.gz |
|---|---|
| Size | 7.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1e593b4de00f3d7e19843655861e22106b9bf695730825327069f337a1047319
|
|
BLAKE2b-256 checksum How to use checksums |
87ee81bb7be0f51cda294d089dd6d4cbc75c4c32c397913cba9973aa1b01bfa3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.9.15 {"installer":{"name":"uv","version":"0.9.15","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Fedora Linux","version":"44","id":"","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / structlog_configfile-1.1.5-py3-none-any.whl
| Download URL | structlog_configfile-1.1.5-py3-none-any.whl |
|---|---|
| Size | 10.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b7142cd48a38795f2302175332b841047505aa9bb5fccc7619c153c5e107c343
|
|
BLAKE2b-256 checksum How to use checksums |
01e9af175a1b54feb60d37b9e545fa68af8368101fbf26d96736aff5ec4e5e88
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.9.15 {"installer":{"name":"uv","version":"0.9.15","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Fedora Linux","version":"44","id":"","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Security for structlog-configfile 1.1.5
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.