日志中心的 python 客户端
## 使用`python`语言的项目,提供工具包,开箱即用
```shell
# 支持以下环境变量配置
export GLC_ENABLE=true # 默认false,要发送日志中心必须配置为true
export GLC_ENABLE_CONSOLE_LOG=true # 默认true,控制台不打印时配置为false
export GLC_API_URL='http://127.0.0.1:8080/glc/v1/log/add' # 未配置时将取消发送
export GLC_API_KEY='X-GLC-AUTH:glogcenter' # 这是默认值,按需修改
export GLC_SYSTEM=default # 默认default,按需修改
export GLC_LOG_LEVEL=debug # 日志级别(debug/info/warn/error),默认debug
export GLC_TRACE_ID=12345 # 默认空
```
```python
# 安装
pip install glogcenter
# 使用
from glogcenter import glc
glc.debug("这是Debug级别日志")
glc.info("这是Info级别日志", "多个参数", "会被拼接")
gd = glc.GlcData()
gd.user = 'abcd'
glc.warn("这里的GlcData类型参数都不会打印", "gd只起传值作用", gd)
glc.error("gd参数顺序无关", gd, "用法如同log库,但对GlcData做了特殊的判断处理")
```
Raw data
{
"_id": null,
"home_page": "https://github.com/gotoeasy/glogcenter",
"name": "glogcenter",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.6.0",
"maintainer_email": null,
"keywords": null,
"author": "gotoeasy",
"author_email": "gotoeasy@163.com",
"download_url": "https://files.pythonhosted.org/packages/72/01/b378f5a89661ff693c8c1f0e5446af6f656f39b7dab3a294f6b52e5390ff/glogcenter-0.17.1.tar.gz",
"platform": null,
"description": "\r\n\u65e5\u5fd7\u4e2d\u5fc3\u7684 python \u5ba2\u6237\u7aef\r\n\r\n\r\n## \u4f7f\u7528`python`\u8bed\u8a00\u7684\u9879\u76ee\uff0c\u63d0\u4f9b\u5de5\u5177\u5305\uff0c\u5f00\u7bb1\u5373\u7528\r\n```shell\r\n# \u652f\u6301\u4ee5\u4e0b\u73af\u5883\u53d8\u91cf\u914d\u7f6e\r\nexport GLC_ENABLE=true # \u9ed8\u8ba4false\uff0c\u8981\u53d1\u9001\u65e5\u5fd7\u4e2d\u5fc3\u5fc5\u987b\u914d\u7f6e\u4e3atrue\r\nexport GLC_ENABLE_CONSOLE_LOG=true # \u9ed8\u8ba4true\uff0c\u63a7\u5236\u53f0\u4e0d\u6253\u5370\u65f6\u914d\u7f6e\u4e3afalse\r\nexport GLC_API_URL='http://127.0.0.1:8080/glc/v1/log/add' # \u672a\u914d\u7f6e\u65f6\u5c06\u53d6\u6d88\u53d1\u9001\r\nexport GLC_API_KEY='X-GLC-AUTH:glogcenter' # \u8fd9\u662f\u9ed8\u8ba4\u503c\uff0c\u6309\u9700\u4fee\u6539\r\nexport GLC_SYSTEM=default # \u9ed8\u8ba4default\uff0c\u6309\u9700\u4fee\u6539\r\nexport GLC_LOG_LEVEL=debug # \u65e5\u5fd7\u7ea7\u522b\uff08debug/info/warn/error\uff09\uff0c\u9ed8\u8ba4debug\r\nexport GLC_TRACE_ID=12345 # \u9ed8\u8ba4\u7a7a\r\n```\r\n\r\n```python\r\n# \u5b89\u88c5\r\npip install glogcenter\r\n\r\n# \u4f7f\u7528\r\nfrom glogcenter import glc\r\n\r\nglc.debug(\"\u8fd9\u662fDebug\u7ea7\u522b\u65e5\u5fd7\")\r\nglc.info(\"\u8fd9\u662fInfo\u7ea7\u522b\u65e5\u5fd7\", \"\u591a\u4e2a\u53c2\u6570\", \"\u4f1a\u88ab\u62fc\u63a5\")\r\ngd = glc.GlcData()\r\ngd.user = 'abcd'\r\nglc.warn(\"\u8fd9\u91cc\u7684GlcData\u7c7b\u578b\u53c2\u6570\u90fd\u4e0d\u4f1a\u6253\u5370\", \"gd\u53ea\u8d77\u4f20\u503c\u4f5c\u7528\", gd)\r\nglc.error(\"gd\u53c2\u6570\u987a\u5e8f\u65e0\u5173\", gd, \"\u7528\u6cd5\u5982\u540clog\u5e93\uff0c\u4f46\u5bf9GlcData\u505a\u4e86\u7279\u6b8a\u7684\u5224\u65ad\u5904\u7406\")\r\n```\r\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "glogcenter \u7684 python \u7248\u5ba2\u6237\u7aef",
"version": "0.17.1",
"project_urls": {
"Homepage": "https://github.com/gotoeasy/glogcenter"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "f060dbdd53b01e319122ee123fa47b0d620671b765f45437370644046ecff016",
"md5": "e2f877f0a42c5975f6fe7deb80a1377f",
"sha256": "2f8fcd0b4944509b8599d7af998dae4d70291f908fdac480f5297bb9156df39c"
},
"downloads": -1,
"filename": "glogcenter-0.17.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "e2f877f0a42c5975f6fe7deb80a1377f",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.6.0",
"size": 5478,
"upload_time": "2024-09-09T03:12:08",
"upload_time_iso_8601": "2024-09-09T03:12:08.761413Z",
"url": "https://files.pythonhosted.org/packages/f0/60/dbdd53b01e319122ee123fa47b0d620671b765f45437370644046ecff016/glogcenter-0.17.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "7201b378f5a89661ff693c8c1f0e5446af6f656f39b7dab3a294f6b52e5390ff",
"md5": "dd4f6e4981077064a67828aeba2b6a1d",
"sha256": "fa0af51e84f8edd3ed12f95d75e74521ffec7ef4de1eda1d97043efe7bbd4387"
},
"downloads": -1,
"filename": "glogcenter-0.17.1.tar.gz",
"has_sig": false,
"md5_digest": "dd4f6e4981077064a67828aeba2b6a1d",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.6.0",
"size": 6281,
"upload_time": "2024-09-09T03:12:10",
"upload_time_iso_8601": "2024-09-09T03:12:10.307190Z",
"url": "https://files.pythonhosted.org/packages/72/01/b378f5a89661ff693c8c1f0e5446af6f656f39b7dab3a294f6b52e5390ff/glogcenter-0.17.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-09-09 03:12:10",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "gotoeasy",
"github_project": "glogcenter",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "glogcenter"
}