python-custom-logger


Namepython-custom-logger JSON
Version 1.0.3 PyPI version JSON
download
home_pagehttps://github.com/Depaccu/python-custom-logger
SummaryThis package provides a python logger which is simple to use and logs structured logs per default for the gcp.
upload_time2023-12-11 13:43:08
maintainer
docs_urlNone
authorJUNGELEN
requires_python>=3.11,<4.0
licenseMIT
keywords gcp logger structured logs
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # python-gcp-logger
This repo provides a python logger wrapper for structured logs on gcp.

## Installation
```
pip install python-custom-logger
or
poetry add python-custom-logger
```

## Usage

```
from custom_logger.logger import CustomStructuredLogger

log_to_cloud: bool = True if <any condition to check if in cloud service env> else False
log_to_console: bool = not log_to_cloud
logger: CustomStructuredLogger = CustomStructuredLogger(
    project_id=<GCP_PROJECT_ID>,
    name="MyLogger",
    log_to_console=log_to_console,
    log_to_cloud=log_to_cloud,
)

logger.info(message="helloworld")
logger.info(message={"hello": "world"})
logger.error(message="helloworld")
logger.error(message={"hello": "world"})
logger.warning(message="helloworld")
logger.warning(message={"hello": "world"})

# Using additional attributes:
logger.info(message={"hello": "world"}, attributes {"foo": "bar"})
```


## TODOs
- add tests
- replace google logger with python logger using structured std out log
            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/Depaccu/python-custom-logger",
    "name": "python-custom-logger",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.11,<4.0",
    "maintainer_email": "",
    "keywords": "gcp,logger,structured,logs",
    "author": "JUNGELEN",
    "author_email": "jeffrey_ungelenk@icloud.com",
    "download_url": "https://files.pythonhosted.org/packages/ec/23/156c6a9f7f4148376f2a5bc35d71debf4643f14e92affdde6ce2572cbeaa/python_custom_logger-1.0.3.tar.gz",
    "platform": null,
    "description": "# python-gcp-logger\nThis repo provides a python logger wrapper for structured logs on gcp.\n\n## Installation\n```\npip install python-custom-logger\nor\npoetry add python-custom-logger\n```\n\n## Usage\n\n```\nfrom custom_logger.logger import CustomStructuredLogger\n\nlog_to_cloud: bool = True if <any condition to check if in cloud service env> else False\nlog_to_console: bool = not log_to_cloud\nlogger: CustomStructuredLogger = CustomStructuredLogger(\n    project_id=<GCP_PROJECT_ID>,\n    name=\"MyLogger\",\n    log_to_console=log_to_console,\n    log_to_cloud=log_to_cloud,\n)\n\nlogger.info(message=\"helloworld\")\nlogger.info(message={\"hello\": \"world\"})\nlogger.error(message=\"helloworld\")\nlogger.error(message={\"hello\": \"world\"})\nlogger.warning(message=\"helloworld\")\nlogger.warning(message={\"hello\": \"world\"})\n\n# Using additional attributes:\nlogger.info(message={\"hello\": \"world\"}, attributes {\"foo\": \"bar\"})\n```\n\n\n## TODOs\n- add tests\n- replace google logger with python logger using structured std out log",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "This package provides a python logger which is simple to use and logs structured logs per default for the gcp.",
    "version": "1.0.3",
    "project_urls": {
        "Homepage": "https://github.com/Depaccu/python-custom-logger",
        "Repository": "https://github.com/Depaccu/python-custom-logger"
    },
    "split_keywords": [
        "gcp",
        "logger",
        "structured",
        "logs"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "9321f7bf3babcf2815b52b35671bb3a1814c978bd2b06f62eed4ce0865eb6213",
                "md5": "ac8dd25f8fafcc898861c5cdb854c2d1",
                "sha256": "ffbeae8425d9fbdbc88a6d2d36594ac102115b93d59bcb4d251d7a045fec193e"
            },
            "downloads": -1,
            "filename": "python_custom_logger-1.0.3-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "ac8dd25f8fafcc898861c5cdb854c2d1",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.11,<4.0",
            "size": 4497,
            "upload_time": "2023-12-11T13:43:07",
            "upload_time_iso_8601": "2023-12-11T13:43:07.093945Z",
            "url": "https://files.pythonhosted.org/packages/93/21/f7bf3babcf2815b52b35671bb3a1814c978bd2b06f62eed4ce0865eb6213/python_custom_logger-1.0.3-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "ec23156c6a9f7f4148376f2a5bc35d71debf4643f14e92affdde6ce2572cbeaa",
                "md5": "bb5ec03eeb3a4cee02958fa0d17288fd",
                "sha256": "1ba3f15ae7702291bea320eb1bf646df372f1b7654054ccdbc8f7dccddade462"
            },
            "downloads": -1,
            "filename": "python_custom_logger-1.0.3.tar.gz",
            "has_sig": false,
            "md5_digest": "bb5ec03eeb3a4cee02958fa0d17288fd",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.11,<4.0",
            "size": 3034,
            "upload_time": "2023-12-11T13:43:08",
            "upload_time_iso_8601": "2023-12-11T13:43:08.619320Z",
            "url": "https://files.pythonhosted.org/packages/ec/23/156c6a9f7f4148376f2a5bc35d71debf4643f14e92affdde6ce2572cbeaa/python_custom_logger-1.0.3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-12-11 13:43:08",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "Depaccu",
    "github_project": "python-custom-logger",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "python-custom-logger"
}
        
Elapsed time: 0.20119s