micro-logger


Namemicro-logger JSON
Version 0.1.4 PyPI version JSON
download
home_pagehttps://github.com/gaf3/python-micro-logger
SummaryA JSON logger made for microservices
upload_time2023-11-08 22:21:31
maintainer
docs_urlNone
authorGaffer Fitch
requires_python
license
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # micro-logger

A JSON logger made for microservices

# Usage

```python
import micro_logger

# This overrides the root logger as well

logger = micro_logger.getLogger("my-service")

logger.info("sure", extra={"a": 1})
```

# Testing

```python
import micro_logger_unittest

import micro_logger

# Use this class as a base

class TestUnitTest(micro_logger_unittest.TestCase):

    # Override for all tests

    @unittest.mock.patch("micro_logger.getLogger", micro_logger_unittest.MockLogger)
    def setUp(self):

        self.logger = micro_logger.getLogger("unit")

    # Any test can check for logging

    def test_assertLogged(self):

        self.logger.info("sure", extra={"a": 1})

        self.assertLogged(self.logger, "info", "sure", extra={"a": 1})
```

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/gaf3/python-micro-logger",
    "name": "micro-logger",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "",
    "author": "Gaffer Fitch",
    "author_email": "micro-logger@gaf3.com",
    "download_url": "https://files.pythonhosted.org/packages/54/bc/eb2b4933202764fa8b40a7a24df50eab1a4c5083dc05a63a061f98a3ceb5/micro-logger-0.1.4.tar.gz",
    "platform": null,
    "description": "# micro-logger\n\nA JSON logger made for microservices\n\n# Usage\n\n```python\nimport micro_logger\n\n# This overrides the root logger as well\n\nlogger = micro_logger.getLogger(\"my-service\")\n\nlogger.info(\"sure\", extra={\"a\": 1})\n```\n\n# Testing\n\n```python\nimport micro_logger_unittest\n\nimport micro_logger\n\n# Use this class as a base\n\nclass TestUnitTest(micro_logger_unittest.TestCase):\n\n    # Override for all tests\n\n    @unittest.mock.patch(\"micro_logger.getLogger\", micro_logger_unittest.MockLogger)\n    def setUp(self):\n\n        self.logger = micro_logger.getLogger(\"unit\")\n\n    # Any test can check for logging\n\n    def test_assertLogged(self):\n\n        self.logger.info(\"sure\", extra={\"a\": 1})\n\n        self.assertLogged(self.logger, \"info\", \"sure\", extra={\"a\": 1})\n```\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "A JSON logger made for microservices",
    "version": "0.1.4",
    "project_urls": {
        "Homepage": "https://github.com/gaf3/python-micro-logger"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "7446bc826a82b8021b276083e0496ada740e85f6d1026ec9770dfe6a2998f77a",
                "md5": "5b9f3a63d7326a4eb90571319307a869",
                "sha256": "4420f632b66c6f64cb53a653d5fe26b6002e4d307d6e66bd5dc09c02eec93fdf"
            },
            "downloads": -1,
            "filename": "micro_logger-0.1.4-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "5b9f3a63d7326a4eb90571319307a869",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 4105,
            "upload_time": "2023-11-08T22:21:30",
            "upload_time_iso_8601": "2023-11-08T22:21:30.658098Z",
            "url": "https://files.pythonhosted.org/packages/74/46/bc826a82b8021b276083e0496ada740e85f6d1026ec9770dfe6a2998f77a/micro_logger-0.1.4-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "54bceb2b4933202764fa8b40a7a24df50eab1a4c5083dc05a63a061f98a3ceb5",
                "md5": "84c3837f1cc08f32afb24d3cad40046a",
                "sha256": "12e8536b81e0fb620ae562c3f24866019a0198f9194193a45f95001f932df754"
            },
            "downloads": -1,
            "filename": "micro-logger-0.1.4.tar.gz",
            "has_sig": false,
            "md5_digest": "84c3837f1cc08f32afb24d3cad40046a",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 4493,
            "upload_time": "2023-11-08T22:21:31",
            "upload_time_iso_8601": "2023-11-08T22:21:31.976103Z",
            "url": "https://files.pythonhosted.org/packages/54/bc/eb2b4933202764fa8b40a7a24df50eab1a4c5083dc05a63a061f98a3ceb5/micro-logger-0.1.4.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-11-08 22:21:31",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "gaf3",
    "github_project": "python-micro-logger",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [],
    "lcname": "micro-logger"
}
        
Elapsed time: 0.17512s