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

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

fw_logging-2.3.1-py3-none-any.whl (9.6 kB view details)

Uploaded Python 3

File details

Details for the file fw_logging-2.3.1-py3-none-any.whl.

File metadata

  • Download URL: fw_logging-2.3.1-py3-none-any.whl
  • Upload date:
  • Size: 9.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.4.1 CPython/3.13.14 Linux/5.15.154+

File hashes

Hashes for fw_logging-2.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 a2576cf85aec45ad6878700bd2b874b33fd159e3606d23ef5407a84d4d6d6bd7
MD5 d8b3d3b4d9e9648417da22afed83a8cd
BLAKE2b-256 31163372407f4231d6d2d609edd3c8ce649763381b5b976872ebaa51f13890e8

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

2.3.1 This release

1 file

2.3.0

1 file

2.2.0

1 file

2.1.0

1 file

2.0.1

1 file

2.0.0

1 file

1.5.0

1 file

1.4.0

1 file

1.3.0

1 file

1.2.3

1 file

1.2.2

1 file

1.2.1

1 file

1.1.1

1 file

1.1.0

1 file

1.0.11

1 file

1.0.10

1 file

1.0.9

1 file

1.0.8

1 file

1.0.7

1 file

1.0.6

1 file

1.0.5

1 file

1.0.4

1 file

1.0.3

1 file

1.0.2

1 file

1.0.1

1 file

1.0.0

1 file

0.4.4

1 file

0.4.3

1 file

0.4.2

1 file

0.4.1

1 file

0.4.0

1 file

0.3.0

1 file

0.2.1

1 file

0.2.0

1 file

0.1.0

1 file

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page