Simple Lambda Toolkit
Project description
SLaT
Simple Lambda Toolkit
Collection of reusable Python tools for lambda development
Logging
Structlog is used for structured JSON logging
Usage
import logging
from slat.log_util import LogUtil
log = LogUtil.init_logger(default_level='INFO', correlation_id_key_val={'request_id': '999'})
log.info('is this JSON: {"answer": 42}')
log.error("the log message", some="value", extra_data=[1, 2, 3, "4"])
# only OUR logger will render as JSON
logging.getLogger("test").warning("hello")
output:
{"event": "is this JSON: {\"answer\": 42}", "level": "info", "logger": "slat.log_util", "request_id": "999", "timestamp": "2019-11-06T21:04:33.517295Z"}
{"event": "the log message", "extra_data": [1, 2, 3, "4"], "level": "error", "logger": "slat.log_util", "request_id": "999", "some": "value", "timestamp": "2019-11-06T21:04:33.517652Z"}
hello
For test runs you can add an ENV flag TESTING_RUN=true
and log statements will be written to ./testing.log
TESTING_RUN=true pytest
Developing
create file ~/.pypirc
[distutils]
index-servers =
pypi
pypitest
[pypi]
repository: https://upload.pypi.org/legacy/
username:
password:
[pypitest]
repository: https://test.pypi.org/legacy/
username:
password:
build
# tick to semver `version` in setup.py
rm -rf dist
python setup.py bdist_wheel --universal
# python setup.py sdist
pypitest
twine upload --repository pypitest dist/*
pip install slat --index-url https://test.pypi.org/simple/
pypi
twine upload --repository pypi dist/*
pip install slat
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 Distributions
No source distribution files available for this release.See tutorial on generating distribution archives.
Built Distribution
Close
Hashes for slat-0.1.11-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | cb591c04ac9e45708c7caf29b01abe922d009b99f86a016b8f2b21593c20ab44 |
|
MD5 | 56e45422d387af3ffa2bf36e3e62cb69 |
|
BLAKE2b-256 | ebfcf45425d9bb55a7978a0508f35e5c89fd13945b3d9635ae0f6d6367b5da24 |