Default logging configuration for uStack style Python applications.
Project description
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 tagenvironment
- K8s Pod Namespace -> Datadog tag
service
- K8s Pod Label
role
-> Datadog tagrole
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
Built Distribution
File details
Details for the file ustack_logging-1.0.1.tar.gz
.
File metadata
- Download URL: ustack_logging-1.0.1.tar.gz
- Upload date:
- Size: 2.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.7.1 CPython/3.11.7 Linux/5.15.0-1050-aws
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3425ef52251acafd4092b37f05917fbf1898eb69db7486e3c0340c8680b5d360 |
|
MD5 | 6e36fb39d166a0fb0cff9874fdfdc4a1 |
|
BLAKE2b-256 | 243c04b6d25dc3044b670a981343dac9960c3857bfc83340b728fd365c36cc06 |
File details
Details for the file ustack_logging-1.0.1-py3-none-any.whl
.
File metadata
- Download URL: ustack_logging-1.0.1-py3-none-any.whl
- Upload date:
- Size: 2.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.7.1 CPython/3.11.7 Linux/5.15.0-1050-aws
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 74f34a777688de5e11ea4f89023b2fe0ba6d851c3cd05371a6771efc23724e64 |
|
MD5 | 83c31d4b2c7055160af05a1796c7d4ea |
|
BLAKE2b-256 | 72231697952534cf88efaccccda92a99454097483ae3483867064498021b4a99 |