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
Metadata
Release files for fw-logging 2.3.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| fw_logging-2.3.1-py3-none-any.whl | Python 3 | none | any | Details |
Release files / fw_logging-2.3.1-py3-none-any.whl
| Download URL | fw_logging-2.3.1-py3-none-any.whl |
|---|---|
| Size | 9.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a2576cf85aec45ad6878700bd2b874b33fd159e3606d23ef5407a84d4d6d6bd7
|
|
BLAKE2b-256 checksum How to use checksums |
31163372407f4231d6d2d609edd3c8ce649763381b5b976872ebaa51f13890e8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.4.1 CPython/3.13.14 Linux/5.15.154+
|