Logging helper library.
Project description
fw-logging
Logging helper module standardizing logging and reducing boilerplate.
Installation
Add as a poetry
dependency to your project:
poetry add fw-logging
Usage
Dev
The default config is recommended for development, sending logs to stdout
and
colorizing level names if a TTY is detected.
import fw_logging
fw_logging.setup_logging()
Prod
Production apps should emit JSON-formatted structured logs instead, which can be
enabled via the envvar FW_LOG_FORMATTER=json
in a ConfigMap.
Config
fw_logging
may be further configured using envvars and/or kwargs passed to
setup_logging
or get_log_config
, where keyword arguments take precedence
using the LogConfig
pydantic model. See the most important envvars with their
defaults below or check out fw_logging.py
for more details.
Envvar | Default |
---|---|
FW_LOG_HANDLER |
"stdout" |
FW_LOG_FORMATTER |
"text" |
FW_LOG_LEVEL |
"INFO" |
Development
Install the project using poetry
and enable pre-commit
:
poetry install
pre-commit install
License
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 Distributions
Built Distribution
Hashes for fw_logging-0.2.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6ee555cc54202c08b675bfef9c1836a2e5ede3b80f707e1eb54de444c8ae0be5 |
|
MD5 | c4d306edafbbc305e81ffdfd30cb4833 |
|
BLAKE2b-256 | ff4f56a9797782909f9cda61c0e3fcf5f4c40eab8ef40c6b08fb638d5ec0ff56 |