Skip to main content

ustack-logging

Default logging configuration for uStack style Python applications.

Installation

pip install ustack-logging

Usage

from ustack_logging.logging_configuration import configure_logging


def main():
    configure_logging()

    # Run your application


if __name__ == "__main__":
    main()

Intent

This library is intended to codify the standard way uStudio Python applications log and report errors when running inside Kubernetes. It takes no configuration because its intent is to enforce a configuration.

However, it is built on datadog-logger, which is configurable. If you need a different configuration, it should be trivial to implement it using that library directly.

Configuration

The library configures the following things:

It sets up the logging library to log the time, log level, module name and log message for every message, and it sets the current log level to INFO.

In order to function, it uses a secret named environment-info in the ustudio-system namespace. The secret must contain the keys environment and datadog-api-key, and the pod must contain a label named role.

If any information is missing or any connections fail it logs a warning and does not error.

It configures the datadog-logger library to send ERROR and above log messages to Datadog as events, with the following tag mapping:

  • environment-info.environment -> Datadog tag environment
  • K8s Pod Namespace -> Datadog tag service
  • K8s Pod Label role -> Datadog tag role

Release files for ustack-logging 1.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ustack-logging 1.0.2
File Size Uploaded
ustack_logging-1.0.2.tar.gz 2.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for ustack-logging 1.0.2
File Interpreter ABI Platform
ustack_logging-1.0.2-py3-none-any.whl Python 3 none any Details

Total release size: 4.9 kB

Release files / ustack_logging-1.0.2.tar.gz

Download URL ustack_logging-1.0.2.tar.gz
Size 2.1 kB
Tags Source
SHA-256 checksum
How to use checksums
d4d61d20868180d6510ff80cef5bb1d8b88384d99448e55da47ac52f25501e2c
BLAKE2b-256 checksum
How to use checksums
12371913825806d49dbac3e21870f1ddefd979eb4c7d40d1abca7d41e3dbdf5d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.4.1 CPython/3.14.6 Linux/7.0.0-1009-aws

Release files / ustack_logging-1.0.2-py3-none-any.whl

Download URL ustack_logging-1.0.2-py3-none-any.whl
Size 2.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3d693649caeb5cf4e624b399c2a168dc5667bb1a3decb2c0a2096ecd7eac5169
BLAKE2b-256 checksum
How to use checksums
4d7390a224f171d0036ef80dbf3323799dc70f96c8445e3b45e2ba562b43c230
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.4.1 CPython/3.14.6 Linux/7.0.0-1009-aws

Release history Release notifications | RSS feed

This release

1.0.2 This release

2 release files

1.0.1

2 release files

1.0.0

2 release files

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