Skip to main content

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

MIT

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)

Table of built distributions (wheels) for fw-logging 2.3.1
File Interpreter ABI Platform
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+

Release history Release notifications | RSS feed

This release

2.3.1 This release

1 release file

2.3.0

1 release file

2.2.0

1 release file

2.1.0

1 release file

2.0.1

1 release file

2.0.0

1 release file

1.5.0

1 release file

1.4.0

1 release file

1.3.0

1 release file

1.2.3

1 release file

1.2.2

1 release file

1.2.1

1 release file

1.1.1

1 release file

1.1.0

1 release file

1.0.11

1 release file

1.0.10

1 release file

1.0.9

1 release file

1.0.8

1 release file

1.0.7

1 release file

1.0.6

1 release file

1.0.5

1 release file

1.0.4

1 release file

1.0.3

1 release file

1.0.2

1 release file

1.0.1

1 release file

1.0.0

1 release file

0.4.4

1 release file

0.4.3

1 release file

0.4.2

1 release file

0.4.1

1 release file

0.4.0

1 release file

0.3.0

1 release file

0.2.1

1 release file

0.2.0

1 release file

0.1.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page