Skip to main content

Inject logging handler for printing message in the format captured by pipeline

Project description

logging-pipeline

Python module to inject logging handler for printing message in the format captured by pipeline.

Install with:

pip install logging-pipeline

If logging is imported a handler is added to the root logger to print the error and warning messages in addition with a format recognized by the pipeline environment executing the script. If the script is executed outside a pipeline nothing is printed. Supported pipelines are:

  • Azure pipelines
  • GitHub actions
  • User defined by environment variables LOGGING_PIPELINE_WARNING_MESSAGE_FORMAT and LOGGING_PIPELINE_ERROR_MESSAGE_FORMAT. The value is used to configure the python logger with {}-format, see LogRecord attributes. E.g. LOGGING_PIPELINE_ERROR_MESSAGE_FORMAT="::%(filename)s:%(lineno)d::%(levelname)s::%(message)s::"

Compatibility

logging-pipeline uses a live-patching system to target the logging library and add a handler.

PyInstaller

The method used to automatically adding a logging handler relies on a .pth file script that python loads at startup. This method does not work when a python application is bundled into an executable with PyInstaller (or similar). If you want to use this tool in an application built with PyInstaller it will need to be manually enabled in your application. This can be done by adding the following line to the top of your main application script:

import logging_pipeline.wrapt_logging

This must be run before logging is imported.

Acknowledgements

The method of patching at runtime is built from the pip_system_certs module.

Project details


Download files

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

Source Distribution

logging_pipeline-0.5.0.tar.gz (4.9 kB view details)

Uploaded Source

Built Distribution

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

logging_pipeline-0.5.0-py3-none-any.whl (5.9 kB view details)

Uploaded Python 3

File details

Details for the file logging_pipeline-0.5.0.tar.gz.

File metadata

  • Download URL: logging_pipeline-0.5.0.tar.gz
  • Upload date:
  • Size: 4.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for logging_pipeline-0.5.0.tar.gz
Algorithm Hash digest
SHA256 d5a00fce134b4d1b34a10889e5c9208ebdaf8cb8815a816fca0129d3572c572f
MD5 2ade51b5bfab454b55153cc75fcb98ff
BLAKE2b-256 ddb71d6ce1b195d988ba85274e70a0c811c04b7149f15c7d67c0b64fe10a5565

See more details on using hashes here.

Provenance

The following attestation bundles were made for logging_pipeline-0.5.0.tar.gz:

Publisher: CI.yml on Spacetown/logging_pipeline

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file logging_pipeline-0.5.0-py3-none-any.whl.

File metadata

File hashes

Hashes for logging_pipeline-0.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 05da4bd443cf591ed6fd3d8429f25fed2196073300ce8740b54f99d0d1f683b8
MD5 5bd84b26c39cab5c958764e3ff4bfbef
BLAKE2b-256 e7155a3d4dd94444f93f62f18932ca91994a895fbd736f5a53dc2ecc09b84b0c

See more details on using hashes here.

Provenance

The following attestation bundles were made for logging_pipeline-0.5.0-py3-none-any.whl:

Publisher: CI.yml on Spacetown/logging_pipeline

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

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