Skip to main content
# 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

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":

```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/*
```


Metadata

Release files for spacemakerlog 0.2.8

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for spacemakerlog 0.2.8
File Interpreter ABI Platform Actions
spacemakerlog-0.2.8-py2.py3-none-any.whl Python 2, Python 3 none any Details for spacemakerlog-0.2.8-py2.py3-none-any.whl

Release files / spacemakerlog-0.2.8-py2.py3-none-any.whl

Download URL spacemakerlog-0.2.8-py2.py3-none-any.whl
Size 3.6 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
c7a828cf030776970ed7ffb3c4632862639f10521afb5c96a736653096e5c1d4
BLAKE2b-256 checksum
How to use checksums
0010f75b4ca58b1d5c8f73d7b7bf1fcc0e790331de66984c6a28db8d8fd2347b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.11.0 pkginfo/1.4.2 requests/2.18.4 setuptools/39.0.1 requests-toolbelt/0.8.0 tqdm/4.19.8 CPython/2.7.10

Security for spacemakerlog 0.2.8

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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page