Inspari logging utilities
Project description
This repository provides Python logging utilities.
Configuration
The inspari.logging module provides unified interface for loading logging configuration files in app code and from
gunicorn. In addition, a range of utilities (service name prefixing, command line colors etc.) are provided.
An example logging configuration file is bundled (example_logging_config.json), along with an example of the usage in
an application context (example_usage.py).
Stream logs
The streamlogs command line utility provides a simple way to stream logs in realtime. To enable log collection, add a handler as part of your logging configuration,
"handlers": {
"web": {
"class": "inspari.logging.AzureBlobStorageHandler",
"formatter": "simple",
"load_dot_env": "true",
"env_key": "ABS_CONNECTION_STRING",
"log_local": "true"
},
...
},
...
"root": {
"level": "INFO",
"handlers": [
"web",
...
]
},
and configure the logs as demonstrated in example_usage.py. The storage account to use for streaming must be specified
via environment variables. In the example case, a connection string is used. Hence, for local development purposes,
it is recommended to create a .env file with the content like,
ABS_CONNECTION_STRING=REDACTED
Note that by default, logs are written to container called logs, so you must create a container with this name,
if it doesn't already exist. If you now run,
poetry run steamlogs
you should be getting logs in (near) realtime from all services connected to the account.
Development
Create a new Python environment with all dependencies installed,
poetry install
That's it! You can validate that the environment is setup correctly by running the tests,
poetry run coverage run -m pytest
Deployment
Update the version in pyproject.toml, run poetry lock, and add a new entry in CHANGELOG.md.
Automatic (preferred)
Merge the changes into master (using PRs). Create a new tag. If the new version is 1.1.1, the new tag would be v1.1.1.
The tag creation will trigger automated deployment of the package to PyPi, as well as synchronization of the code with the public GitHub mirror repository.
Manual (not recommended)
Build the project via Poetry,
poetry build
and push it to pypi,
poetry publish -u __token__ -p $INSPARI_PYPI_TOKEN
Project details
Release history Release notifications | RSS feed
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file inspari_logging-0.1.5.tar.gz.
File metadata
- Download URL: inspari_logging-0.1.5.tar.gz
- Upload date:
- Size: 13.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.0.1 CPython/3.12.3 Linux/6.8.0-1020-azure
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a4187dcd7b0087c8a5d2fe96db83ba1385eec574835d67d31954711ab1f72381
|
|
| MD5 |
ae81a37cf69864bb9ca5af6537619801
|
|
| BLAKE2b-256 |
02619df83e4f083e08a3cc21c83e0af37ae3c001355367fe757c14b2c2725c26
|
File details
Details for the file inspari_logging-0.1.5-py3-none-any.whl.
File metadata
- Download URL: inspari_logging-0.1.5-py3-none-any.whl
- Upload date:
- Size: 18.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.0.1 CPython/3.12.3 Linux/6.8.0-1020-azure
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2ce375739567bbaadf9ca47b3b2b04d3482d4542bc03e3642276126b8d54620d
|
|
| MD5 |
5a22846f1e969bf50e22d648ef41bea4
|
|
| BLAKE2b-256 |
e7d15104e9851671bc26c4888b9418912ff2e7ce68fcd12ee8be836214761a46
|