Structured logging for Spacemaker AI
Project description
# log
Python library/client for structured log output
```bash
pip install spacemakerlog
```
## Usage
```python
from spacemakerlog import log
log.debug('hello something happened', some_key='with some value', another_key=123.12)
```
Output:
```bash
{"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:
```python
from spacemakerlog import log
try:
raise Exception('some error message')
except Exception as e:
log.error('oooops, an error occured while doing something', exception=e)
```
Output:
```bash
{"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
Set log format to "text":
```python
log.set_format('text');
```
Set log level to "info":
```python
log.set_level('info');
```
## Publish
Using [twine](https://pypi.org/project/twine/) for publishing to [PyPI](https://pypi.org/project/spacemakerlog/).
```bash
brew install twine
```
```bash
python setup.py bdist_wheel
twine upload dist/*
```
Python library/client for structured log output
```bash
pip install spacemakerlog
```
## Usage
```python
from spacemakerlog import log
log.debug('hello something happened', some_key='with some value', another_key=123.12)
```
Output:
```bash
{"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:
```python
from spacemakerlog import log
try:
raise Exception('some error message')
except Exception as e:
log.error('oooops, an error occured while doing something', exception=e)
```
Output:
```bash
{"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
Set log format to "text":
```python
log.set_format('text');
```
Set log level to "info":
```python
log.set_level('info');
```
## Publish
Using [twine](https://pypi.org/project/twine/) for publishing to [PyPI](https://pypi.org/project/spacemakerlog/).
```bash
brew install twine
```
```bash
python setup.py bdist_wheel
twine upload dist/*
```
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 spacemakerlog-0.2.3-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3fa93c2817010fcb4123bef5cfa1744e20b65450712bd6d48c1e968d75099e78 |
|
MD5 | d8b644dbb3e5590e6e00d697ecacb7dc |
|
BLAKE2b-256 | 682b3edb36cd26f23a5a962a66fe7cc80077ac093f2fef998445e5a75dd32e6e |