Logging helper library.
Project description
fw-logging
Logging helper library for standard logging configuration, JSON formatting,
and for tailing (non-)structured logs re-formatted and colorized for humans.
Installation
pip install fw-logging
Usage
logformat
Use the CLI utility logformat to re-format (Flywheel) logs for humans:
# pipe json and/or text logs directly
kubectl logs my-pod | logformat
# OR pass a filename containing the same
kubectl logs my-pod > my-pod.log
logformat my-pod.log
# OR pass a rich text file (.rtf) of logs
logformat my-pod-log.rtf
Library
Use the fw_logging module to set up python logging in 2 lines:
import fw_logging
fw_logging.setup_logging()
The default configuration sets up logging at level INFO to stdout, formatted
as text with colorized levels and caller information.
To emit structured JSON logs in production just override the formatter using an
environment variable: FW_LOG_FORMATTER=json.
Table of main config options and the corresponding envvars:
| Envvar | Default | Alternative / Example |
|---|---|---|
FW_LOG_LEVEL |
INFO |
DEBUG |
FW_LOG_HANDLER |
stdout |
stderr |
FW_LOG_FORMATTER |
text |
json |
FW_LOG_LOGGERS |
{"pika":"ERROR"} |
|
FW_LOG_FILTERS |
{"lgr":{"msg":"rgx"}} |
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file fw_logging-2.3.0-py3-none-any.whl.
File metadata
- Download URL: fw_logging-2.3.0-py3-none-any.whl
- Upload date:
- Size: 9.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.9 {"installer":{"name":"uv","version":"0.9.9"},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Alpine Linux","version":"3.23.0_alpha20251016","id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d90e1b983de318d8777df47df1adf37a5d1ce449e9b735b1a912e98e7d8e2aa1
|
|
| MD5 |
7a076f285481a91947142903a93b5674
|
|
| BLAKE2b-256 |
c82bddef024f725417c4f7ad6362a8ce4b6c065fb98d7e9e2891f8ef98a95f74
|