Metadata-Version: 2.1
Name: simplestructlogs
Version: 0.0.2
Summary: A simple wrapper around the standard logging library to support structured logging.
Author-email: Calvin Echols <calvin@cechols.com>
Project-URL: Homepage, https://github.com/CalvinE/simplestructlogs-py
Project-URL: Bug Tracker, https://github.com/CalvinE/simplestructlogs-py/issues
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE

# simplestructlogs

A simple wrapper around the python standard logging library that supports structured logs.

JSON logs are supported out of the box, but you can write your own log record classes to support other formats!

## Example Usage

```python
from simplestructlogs import StructuredLogger
import logging

def raise_err():
    raise Exception("BOOM")

if __name__ == "__main__":
    logger = StructuredLogger.get_default_logger("calvin", logging.DEBUG, {"parent-context": "This is cool!"})
    logger.debug("debug test")
    child_logger = logger.make_child_context_logger("calvin-child", {"child-context": "woo hoo!"})
    err = KeyError("uh oh")
    child_logger.info("an error", exc_info=err, stack_info=True, extra={"value1": 123, "value2": {"value3" :"456"}})
    try:
        raise_err()
    except Exception as e:
        logger.exception("testing exception logging")
        logger.warn("test with warning", exc_info=e)
        logger.warn("test with warning", is_exception_call=True)

```
