simplestructlogs


Namesimplestructlogs JSON
Version 0.0.4 PyPI version JSON
download
home_page
SummaryA simple wrapper around the standard logging library to support structured logging.
upload_time2023-08-27 16:20:42
maintainer
docs_urlNone
author
requires_python>=3.8
license
keywords logging structured structured-logging
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # 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)

```

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "simplestructlogs",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": "",
    "keywords": "logging,structured,structured-logging",
    "author": "",
    "author_email": "Calvin Echols <calvin@cechols.com>",
    "download_url": "https://files.pythonhosted.org/packages/25/d9/773751cef6c306d6f15a3268bf1005a7004f1e3decf443f915be5862d254/simplestructlogs-0.0.4.tar.gz",
    "platform": null,
    "description": "# simplestructlogs\n\nA simple wrapper around the python standard logging library that supports structured logs.\n\nJSON logs are supported out of the box, but you can write your own log record classes to support other formats!\n\n## Example Usage\n\n```python\nfrom simplestructlogs import StructuredLogger\nimport logging\n\ndef raise_err():\n    raise Exception(\"BOOM\")\n\nif __name__ == \"__main__\":\n    logger = StructuredLogger.get_default_logger(\"calvin\", logging.DEBUG, {\"parent-context\": \"This is cool!\"})\n    logger.debug(\"debug test\")\n    child_logger = logger.make_child_context_logger(\"calvin-child\", {\"child-context\": \"woo hoo!\"})\n    err = KeyError(\"uh oh\")\n    child_logger.info(\"an error\", exc_info=err, stack_info=True, extra={\"value1\": 123, \"value2\": {\"value3\" :\"456\"}})\n    try:\n        raise_err()\n    except Exception as e:\n        logger.exception(\"testing exception logging\")\n        logger.warn(\"test with warning\", exc_info=e)\n        logger.warn(\"test with warning\", is_exception_call=True)\n\n```\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "A simple wrapper around the standard logging library to support structured logging.",
    "version": "0.0.4",
    "project_urls": {
        "Bug Tracker": "https://github.com/CalvinE/simplestructlogs-py/issues",
        "Homepage": "https://github.com/CalvinE/simplestructlogs-py"
    },
    "split_keywords": [
        "logging",
        "structured",
        "structured-logging"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "36914e864ce834109409a0120fffa3da276b90775026214ab0b58cb9b37f0663",
                "md5": "2bf9ea9368cba55cb86c4b679150cbab",
                "sha256": "8e27d6638580292975302be220378aaf5e72f2eb0c67db05e26555fb5b82f7d1"
            },
            "downloads": -1,
            "filename": "simplestructlogs-0.0.4-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "2bf9ea9368cba55cb86c4b679150cbab",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 6617,
            "upload_time": "2023-08-27T16:20:41",
            "upload_time_iso_8601": "2023-08-27T16:20:41.370984Z",
            "url": "https://files.pythonhosted.org/packages/36/91/4e864ce834109409a0120fffa3da276b90775026214ab0b58cb9b37f0663/simplestructlogs-0.0.4-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "25d9773751cef6c306d6f15a3268bf1005a7004f1e3decf443f915be5862d254",
                "md5": "1fe763afeb619c03eaf2b6dbeaf7d9c3",
                "sha256": "b2dbb75b157d46028f0da42a0eb97aed488ff96e05f34a2597237982f643537a"
            },
            "downloads": -1,
            "filename": "simplestructlogs-0.0.4.tar.gz",
            "has_sig": false,
            "md5_digest": "1fe763afeb619c03eaf2b6dbeaf7d9c3",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 5344,
            "upload_time": "2023-08-27T16:20:42",
            "upload_time_iso_8601": "2023-08-27T16:20:42.788869Z",
            "url": "https://files.pythonhosted.org/packages/25/d9/773751cef6c306d6f15a3268bf1005a7004f1e3decf443f915be5862d254/simplestructlogs-0.0.4.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-08-27 16:20:42",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "CalvinE",
    "github_project": "simplestructlogs-py",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "simplestructlogs"
}
        
Elapsed time: 0.10431s