dislog


Namedislog JSON
Version 2.1.0 PyPI version JSON
download
home_pagehttps://github.com/regulad/dislog
SummaryProvides an interface for using a discord webhook as a logger.
upload_time2023-01-30 12:59:42
maintainer
docs_urlNone
authorregulad
requires_python<4,>=3.10
licenseGPLv3
keywords requests
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # [dislog](https://pypi.org/project/dislog/)

###### Previously [`discord-webhook-logger`](https://pypi.org/project/discord-webhook-logger/)

Provides an interface for using a Discord webhook as a logger.

Designed to abstract away webhook-specific details, such as the JSON format, and provide a simple interface for logging messages.

## Example

Using `dislog` in your projects is dead simple. It behaves like any other `logging.Handler`.

For performance reasons, it even fires off a new thread for each log message, so you don't have to worry about blocking your main thread with costly HTTP requests.

```py
from dislog import DiscordWebhookHandler
from logging import *

basicConfig(level=ERROR, handlers=[StreamHandler(), DiscordWebhookHandler("url", DEBUG)])

error("hi")
```

It also works with asynchronous code, simply pass the `run_async` keyword argument. This is optional and makes it use the event loop instead of a thread pool.

```py
from dislog import DiscordWebhookHandler
from logging import *
from asyncio import run, sleep

async def main():
    basicConfig(level=ERROR, handlers=[StreamHandler(), DiscordWebhookHandler("url", run_async=True)])
    
    error("hi")
    
    await sleep(1)  # Give it some time to run!

run(main())
```

![img.png](img.png)

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/regulad/dislog",
    "name": "dislog",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "<4,>=3.10",
    "maintainer_email": "",
    "keywords": "requests",
    "author": "regulad",
    "author_email": "regulad@regulad.xyz",
    "download_url": "https://files.pythonhosted.org/packages/48/c0/6c6b6af6568aa353d33041275bffeda426c2396b84445fdd4ef2bc1615b3/dislog-2.1.0.tar.gz",
    "platform": null,
    "description": "# [dislog](https://pypi.org/project/dislog/)\n\n###### Previously [`discord-webhook-logger`](https://pypi.org/project/discord-webhook-logger/)\n\nProvides an interface for using a Discord webhook as a logger.\n\nDesigned to abstract away webhook-specific details, such as the JSON format, and provide a simple interface for logging messages.\n\n## Example\n\nUsing `dislog` in your projects is dead simple. It behaves like any other `logging.Handler`.\n\nFor performance reasons, it even fires off a new thread for each log message, so you don't have to worry about blocking your main thread with costly HTTP requests.\n\n```py\nfrom dislog import DiscordWebhookHandler\nfrom logging import *\n\nbasicConfig(level=ERROR, handlers=[StreamHandler(), DiscordWebhookHandler(\"url\", DEBUG)])\n\nerror(\"hi\")\n```\n\nIt also works with asynchronous code, simply pass the `run_async` keyword argument. This is optional and makes it use the event loop instead of a thread pool.\n\n```py\nfrom dislog import DiscordWebhookHandler\nfrom logging import *\nfrom asyncio import run, sleep\n\nasync def main():\n    basicConfig(level=ERROR, handlers=[StreamHandler(), DiscordWebhookHandler(\"url\", run_async=True)])\n    \n    error(\"hi\")\n    \n    await sleep(1)  # Give it some time to run!\n\nrun(main())\n```\n\n![img.png](img.png)\n",
    "bugtrack_url": null,
    "license": "GPLv3",
    "summary": "Provides an interface for using a discord webhook as a logger.",
    "version": "2.1.0",
    "split_keywords": [
        "requests"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "48c06c6b6af6568aa353d33041275bffeda426c2396b84445fdd4ef2bc1615b3",
                "md5": "d12dbe46c7049eea9e88036cf87c4dd0",
                "sha256": "f85bbd16553b08c05f73bbc9f90af57e5994bb9e0c4d136e13d67b14bde638f9"
            },
            "downloads": -1,
            "filename": "dislog-2.1.0.tar.gz",
            "has_sig": false,
            "md5_digest": "d12dbe46c7049eea9e88036cf87c4dd0",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4,>=3.10",
            "size": 16159,
            "upload_time": "2023-01-30T12:59:42",
            "upload_time_iso_8601": "2023-01-30T12:59:42.243103Z",
            "url": "https://files.pythonhosted.org/packages/48/c0/6c6b6af6568aa353d33041275bffeda426c2396b84445fdd4ef2bc1615b3/dislog-2.1.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-01-30 12:59:42",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": "regulad",
    "github_project": "dislog",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "dislog"
}
        
Elapsed time: 0.04762s