```python3
# NOTE: You should import gllogger before executing any other code.
from gllogger import gL
gL.enableGlobalHandler(True)
gL.setGlobalLevel(logging.DEBUG)
...
```
```python3
# You can log into the console,
gL.getLogger(__name__).init(gL.OT_console)
# or you can pass logs into a function,
def gL_function(text):
print(text)
gL.setFunction(gL_function)
gL.getLogger(__name__).init(gL.OT_function)
# or you can write logs to files.
import os
gL.setLogDir(os.path.join(os.getcwd(), "log", ))
gL.getLogger(__name__).init(gL.OT_logging)
# Then, use the following function anywhere to log.
gL.debugs("a", 1, True, )
gL.infos()
gL.warns()
gL.errors()
"""
[DEBUG 00:00:00 main[15].<module>] a 1 True
"""
```
```python3
# You can use 'gL(Exception)' to enable logging of complete exception tracebacks,
# and if you have 'better_exceptions' installed, the tracebacks will be even more detailed.
# $ pip install better_exceptions
try:
def f(a, b):
return a / b
f(1, 0)
except ZeroDivisionError as e:
gL.warns(gL(e))
"""
[WARNING 00:00:00 main[10].<module>] Traceback (most recent call last):
File "/tmp/main.py", line 8, in <module>
f(1, 0)
└ <function f at 0x04E264A8>
File "/tmp/main.py", line 6, in f
return a / b
│ └ 0
└ 1
"""
```
Raw data
{
"_id": null,
"home_page": null,
"name": "gllogger",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.6",
"maintainer_email": null,
"keywords": "logger, global logger, logger hook, easy logger",
"author": null,
"author_email": "calm51 <calm51@protonmail.com>",
"download_url": "https://files.pythonhosted.org/packages/10/00/49e89e3e4d2a5620779437137a191ed26cf3af433ea63be9d77d5064d888/gllogger-0.0.8.tar.gz",
"platform": null,
"description": "```python3\n# NOTE: You should import gllogger before executing any other code.\nfrom gllogger import gL\n\ngL.enableGlobalHandler(True)\ngL.setGlobalLevel(logging.DEBUG)\n\n...\n```\n\n```python3\n# You can log into the console,\ngL.getLogger(__name__).init(gL.OT_console)\n\n# or you can pass logs into a function,\ndef gL_function(text):\n print(text)\ngL.setFunction(gL_function)\ngL.getLogger(__name__).init(gL.OT_function)\n\n# or you can write logs to files.\nimport os\ngL.setLogDir(os.path.join(os.getcwd(), \"log\", ))\ngL.getLogger(__name__).init(gL.OT_logging)\n\n\n# Then, use the following function anywhere to log.\ngL.debugs(\"a\", 1, True, )\ngL.infos()\ngL.warns()\ngL.errors()\n\n\"\"\"\n[DEBUG 00:00:00 main[15].<module>] a 1 True\n\"\"\"\n\n```\n\n```python3\n# You can use 'gL(Exception)' to enable logging of complete exception tracebacks,\n# and if you have 'better_exceptions' installed, the tracebacks will be even more detailed.\n# $ pip install better_exceptions\n\ntry:\n def f(a, b):\n return a / b\n f(1, 0)\nexcept ZeroDivisionError as e:\n gL.warns(gL(e))\n\n\"\"\"\n[WARNING 00:00:00 main[10].<module>] Traceback (most recent call last):\n File \"/tmp/main.py\", line 8, in <module>\n f(1, 0)\n \u2514 <function f at 0x04E264A8>\n File \"/tmp/main.py\", line 6, in f\n return a / b\n \u2502 \u2514 0\n \u2514 1\n\"\"\"\n\n```\n",
"bugtrack_url": null,
"license": null,
"summary": "gllogger",
"version": "0.0.8",
"project_urls": {
"Homepage": "https://github.com/calm51/gllogger",
"Issues": "https://github.com/calm51/gllogger/issues"
},
"split_keywords": [
"logger",
" global logger",
" logger hook",
" easy logger"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "319af948ec7e798339313e31a66bbf05d440c77ce8ddf329a3683725b42edff1",
"md5": "b4001ea7d072a977e76982dc8b9c764d",
"sha256": "975088a6b29eb3a323e024017895c4e473724d32089219c4b6951f6f6f833d0b"
},
"downloads": -1,
"filename": "gllogger-0.0.8-py3-none-any.whl",
"has_sig": false,
"md5_digest": "b4001ea7d072a977e76982dc8b9c764d",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.6",
"size": 5237,
"upload_time": "2024-04-26T12:34:52",
"upload_time_iso_8601": "2024-04-26T12:34:52.680245Z",
"url": "https://files.pythonhosted.org/packages/31/9a/f948ec7e798339313e31a66bbf05d440c77ce8ddf329a3683725b42edff1/gllogger-0.0.8-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "100049e89e3e4d2a5620779437137a191ed26cf3af433ea63be9d77d5064d888",
"md5": "4ea579cbe70059bdbfa5657f68c1c303",
"sha256": "19d0e3c11371038ecae3f14706c0298eb0702698415dcc849e35015f1e84e080"
},
"downloads": -1,
"filename": "gllogger-0.0.8.tar.gz",
"has_sig": false,
"md5_digest": "4ea579cbe70059bdbfa5657f68c1c303",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.6",
"size": 5028,
"upload_time": "2024-04-26T12:34:53",
"upload_time_iso_8601": "2024-04-26T12:34:53.563676Z",
"url": "https://files.pythonhosted.org/packages/10/00/49e89e3e4d2a5620779437137a191ed26cf3af433ea63be9d77d5064d888/gllogger-0.0.8.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-04-26 12:34:53",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "calm51",
"github_project": "gllogger",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "gllogger"
}