log
Python library/client for structured log output
pip install spacemakerlog3
NB: As for now the log client for Python3 only supports logging JSON format.
Usage
from spacemakerlog3 import log
log.debug('hello something happened', some_key='with some value', another_key=123.12)
Output:
{"message": "hello something happened", "timestamp": "2018-08-05T18:08:01.780036Z", "another_key": 123.12, "level": "debug", "some_key": "with some value"}
Log exception with stacktrace:
from spacemakerlog3 import log
try:
raise Exception('some error message')
except Exception as e:
log.error('oooops, an error occured while doing something', exception=e)
Output:
{"message": "oooops, an error occured while doing something", "timestamp": "2018-08-15T08:49:46.707435Z", "level": "error", "exception": "Traceback (most recent call last):\n File \"/someProject/some-spacemaker-app/some_module.py\", line 76, in some_method\n raise Exception('some error message')\nException: some error message"}
Settings
The log client will read from environment variables at "init" for log level and format.
| Env | default |
|---|---|
LOG_FORMAT |
"json" |
LOG_LEVEL |
"debug" |
Set log format to "text":
log.set_format('text')
Set log level to "info":
log.set_level('info')
Publish
Using twine for publishing to PyPI.
pip install twine
python setup.py bdist_wheel
twine upload dist/*
Metadata
Release files for spacemakerlog3 0.3.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| spacemakerlog3-0.3.1-py2.py3-none-any.whl | Python 2, Python 3 | none | any | Details for spacemakerlog3-0.3.1-py2.py3-none-any.whl |
Release files / spacemakerlog3-0.3.1-py2.py3-none-any.whl
| Download URL | spacemakerlog3-0.3.1-py2.py3-none-any.whl |
|---|---|
| Size | 5.0 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
a14aa162edd1be240fd6f7e562a1d4cb0f0895fe321a82bcbd08dcb2eb222656
|
|
BLAKE2b-256 checksum How to use checksums |
969eeb83570d72ad28912d3856f6a3930c86c43bfaf43a9a0acfcb4a1fec8ffd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.15.0 pkginfo/1.5.0.1 requests/2.19.1 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/2.7.16
|
Security for spacemakerlog3 0.3.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.