{ "info": { "author": "WangZhongYing", "author_email": "kerbalwzy@gmail.com", "bugtrack_url": null, "classifiers": [], "description": "# PCPXlog\nPython\u7248-\u590d\u5408\u65e5\u5fd7\u6a21\u5757, \u901a\u8fc7\u7b80\u5355\u7684\u914d\u7f6e\u5373\u53ef\u4ee5\u5c06\u65e5\u5fd7\u540c\u65f6\u8f93\u51fa\u5230\u63a7\u5236\u53f0\u3001\u6587\u4ef6\u3001\u6570\u636e\u5e93\u7b49.\n\nPython version of the composite log module, through simple configuration, can output the log to the console, file, database at the same time.\n\n-----\n\n### \u7b2c\u4e00\u6b65: \u5b89\u88c5\u6a21\u5757\n\n### Installation\n\n\u76ee\u524d\u4f60\u53ef\u4ee5\u901a\u8fc7\u4e24\u79cd\u65b9\u5f0f\u5b89\u88c5,\u63a8\u8350\u4f7f\u7528\u7b2c\u4e00\u79cd.\n\nAt present, you can install it in two ways. The first one is recommended.\n\n\u7b2c\u4e00\u79cd\u901a\u8fc7pip\u76f4\u63a5\u5b89\u88c5, \u53ea\u9700\u8981\u5728\u7ec8\u7aef\u4e2d\u8f93\u5165\u5982\u4e0b\u547d\u4ee4\u5373\u53ef\u5b89\u88c5\u8fd9\u4e2a\u6a21\u5757\u7684\u6700\u65b0\u7a33\u5b9a\u7248\u672c.\n\nThe first one is installed directly through pip, and the latest stable version of this module can be installed only by typing the following commands in the terminal.\n\n```shell\npip3 install pcpxlog \n```\n\n\u7b2c\u4e8c\u79cd\u901a\u8fc7git\u4ed3\u5e93\u6e90\u4ee3\u7801\u5b89\u88c5.\n\nThe second is installed through git repository source code.\n\n```\npip3 install git+https://github.com/kerbalwzy/PCPXlog.git@master\n```\n\n----\n\n### \u7b2c\u4e8c\u6b65: \u4f7f\u7528\u6a21\u5757\n\n### Quick start\n\n\u5728\u5b89\u88c5\u597dcpxlog\u5305\u540e\u53ef\u901a\u8fc7\u5728\u7ec8\u7aef\u4e2d\u8f93\u5165\u547d\u4ee4 \u201c cpxConfigDemo \u201d \u5728\u5f53\u524d\u8def\u5f84\u4e0b\u7acb\u5373\u5f97\u5230\u4e00\u4e2a\u9ed8\u8ba4\u7684\u914d\u7f6e\u6587\u4ef6, \u8fd9\u4e2a\u6587\u4ef6\u7684\u540d\u79f0\u53eb\u505a [cpxLogConfig.py](), \u6587\u4ef6\u8be6\u7ec6\u5185\u5bb9\u89c1\u94fe\u63a5.\n\nAfter installing the cpxlog package, a default configuration file named [cpxLogConfig.py](), can be obtained immediately by typing the command \"cpxConfigDemo\" in the terminal under the current path. The details of the file can be found in the link.\n\n\u76ee\u524d\u6211\u8ba4\u4e3acpxlog\u80fd\u88ab\u4f7f\u7528\u5230\u7684\u60c5\u51b5\u4e3b\u8981\u6709\u4ee5\u4e0b\u4e24\u79cd, \u7b2c\u4e00\u79cd\u662f\u76f4\u63a5\u901a\u8fc7CPXLogger\u83b7\u53d6\u5230logger\u5bf9\u8c61\u4f7f\u7528, \u793a\u4f8b\u4ee3\u7801\u5982\u4e0b:\n\nAt present, I think there are two main situations in which cpxlog can be used. The first one is to get logger objects directly through CPXLogger. The sample code is as follows:\n\n```python\nfrom pcpxlog import CPXLogger\n\nfrom cpxLogConfig import CPXLogConfigDemo \n# from the cpxLogConfig.py import the config demo class\n\n# load config information from class\nCPXLogger.config_from_class(CPXLogConfigDemo)\n# ... also support load config from dict and json file.\n\n# create logger\nlogger = CPXLogger.create_logger()\n\n# use logger to record log information\nlogger.debug(\"This is a test for DEBUG level\")\nlogger.info(\"This is a test for INFO level\")\n# ... more log level are supported\n```\n\n\u7b2c\u4e8c\u79cd\u662f\u5728\u914d\u5408\u5176\u4ed6\u6846\u67b6\u4f7f\u7528\u65f6,\u5c06CPXLogger\u521b\u5efa\u7684\u6240\u6709hander\u5bf9\u8c61,\u6dfb\u52a0\u5230\u5168\u5c40\u7684logger\u5bf9\u8c61\u4e2d\u53bb, \u8fd9\u6837\u8ba9\u5176\u4ed6\u6846\u67b6\u5728\u8fd0\u884c\u4e2d\u4fdd\u5b58log\u4fe1\u606f\u65f6\u4e5f\u80fd\u6309\u7167\u6211\u4eec\u7ed9CPXLogger\u914d\u7f6e\u7684\u89c4\u5219\u4fdd\u5b58.\n\nThe second is to add all hander objects created by CPXLogger to the global logger object when used with other frameworks, so that other frameworks can save log information in operation according to the rules we configure CPXLogger.\n\n```python\nimport logging\nfrom pcpxlog import CPXLogger\nfrom cpxLogConfig import CPXLogConfigDemo \n\nCPXLogger.config_from_class(CPXLogConfigDemo)\n\n# get global_logger\nglobal_logger = logging.getLogger()\n# add handler from CPXLogger.handlers\nfor handler in CPXLogger.handlers:\n global_logger.addHandler(handler)\n```\n\n\u26a0\ufe0f \u5173\u4e8e\u914d\u7f6e\u6587\u4ef6\u4e2d\u7684\u914d\u7f6e\u4fe1\u606f\u7c7b\u8be5\u5982\u4f55\u53bb\u5199, \u8bf7\u53c2\u8003\u901a\u8fc7\u547d\u4ee4\u751f\u6210\u7684\u90a3\u4e2a \u201c[cpxLogConfig.py]()\u201d \u6587\u4ef6.\n\n\u26a0\ufe0f Refer to the \u201c[cpxLogConfig.py]()\u201d file generated by the command for how to write the configuration information class in the configuration file.\n\n----\n\n### \u66f4\u591a\u4fe1\u606f\u548c\u672a\u6765\u53d1\u5c55\u65b9\u5411\n\n### More and Future\n\n\u76ee\u524d\u8fd9\u4e2acpxlog\u5305\u80fd\u5e2e\u52a9\u6211\u4eec\u901a\u8fc7\u914d\u7f6e,\u5c06\u65e5\u5fd7\u4fe1\u606f\u8f93\u51fa\u5230\u63a7\u5236\u53f0, \u6587\u4ef6, MongoDB\u6570\u636e\u5e93. \n\n\u672a\u6765\u8fd8\u5e0c\u671b\u53ef\u4ee5\u5e2e\u52a9\u6211\u4eec\u5c06\u65e5\u5fd7\u4fe1\u606f\u8f93\u51fa\u5230\u66f4\u591a\u7684\u5730\u65b9, \u4f8b\u5982MySQL, HTTP, Socket \u7b49. \u4e5f\u5e0c\u671b\u53ef\u4ee5\u901a\u8fc7\u7b80\u5355\u7684\u914d\u7f6e\u5c31\u53ef\u4ee5\u5b9e\u73b0\u5728\u65e5\u5fd7\u4fe1\u606f\u4fdd\u5b58\u5931\u8d25\u65f6\u81ea\u52a8\u53d1\u9001\u8b66\u544a\u90ae\u4ef6\u7ed9\u7ba1\u7406\u5458.\n\n\u5982\u679c\u4f60\u60f3\u8981\u52a0\u5165\u8fd9\u4e2a\u9879\u76ee\u4e2d, \u8bf7Fork\u8fd9\u4e2a\u9879\u76ee\u5230\u4f60\u7684Git\u7528\u6237, \u7136\u540e\u52a0\u5165\u4f60\u7684\u529f\u80fd\u4ee3\u7801, \u7136\u540e\u53d1\u8d77\u4e00\u4e2aPull Requests. \u540c\u65f6\u4e3a\u4e86\u5c3d\u91cf\u907f\u514d\u51fa\u73b0\u591a\u4e2a\u4eba\u60f3\u8981\u6dfb\u52a0\u540c\u6837\u529f\u80fd\u7684\u95ee\u9898, \u8bf7\u5728Issues\u4e2d\u58f0\u660e\u63d0\u524d\u4f60\u60f3\u4e3a\u8fd9\u4e2a\u9879\u76ee\u8d21\u732e\u4ec0\u4e48. \u540c\u65f6\u4e5f\u53ef\u4ee5\u5728Issues\u4e2d\u67e5\u770b\u4f60\u60f3\u6dfb\u52a0\u7684\u529f\u80fd\u662f\u5426\u5df2\u7ecf\u6709\u4eba\u5728\u505a\u6216\u8005\u5df2\u7ecf\u5b8c\u6210\u4e86.\n\nAt present, the cpxlog package can help us output log information to console, file and MongoDB database through configuration.\n\nIn the future, we hope it can help us output log information to more places, such as MySQL, HTTP, Socket and so on. We also hope it can automatically send warning messages to administrators when log information fails to save through simple configuration.\n\nIf you want to join this project, please Fork this project to your Git users, then add your code, and then launch a Pull Requests. At the same time, in order to avoid the problem that many people want to add the same function, please declare in Issues what you want to contribute to this project in advance. Also, you can check in Issues to see if the function you want to add already some people is doing or have finished it.\n\n---\n\n### \u76ee\u524d\u652f\u6301\u7684\u65e5\u5fd7\u8f93\u51fa\u65b9\u5f0f\n\n### Supported Present\n\n```reStructuredText\n----------------------------------\nCPXLogger Config Handler Support |\n----------------------------------\nPresent: |\n console |\n file |\n rotating_file |\n rotating_mongodb |\n----------------------------------\nFuture: |\n mysql |\n redis |\n .... |\n----------------------------------\n```\n\n\n\n\n\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/kerbalwzy/PCPXlog", "keywords": "cpxlog,pcpxlog,kerbalwzy,wangzhongying", "license": "Mozilla Public License Version 2.0", "maintainer": "", "maintainer_email": "", "name": "pcpxlog", "package_url": "https://pypi.org/project/pcpxlog/", "platform": "", "project_url": "https://pypi.org/project/pcpxlog/", "project_urls": { "Homepage": "https://github.com/kerbalwzy/PCPXlog" }, "release_url": "https://pypi.org/project/pcpxlog/0.1/", "requires_dist": [ "pymongo" ], "requires_python": ">=3", "summary": "Simple configuration allows log output to console, file, database at the same time", "version": "0.1" }, "last_serial": 5230425, "releases": { "0.1": [ { "comment_text": "", "digests": { "md5": "5e37c70c66ccd19acf5fdb210d46b221", "sha256": "bb02edc5158b1e7fd0c8b01524dc7bd8c1842a0c4ec011bd4b1b143010ab5e76" }, "downloads": -1, "filename": "pcpxlog-0.1-py3-none-any.whl", "has_sig": false, "md5_digest": "5e37c70c66ccd19acf5fdb210d46b221", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3", "size": 16654, "upload_time": "2019-05-06T02:19:42", "url": "https://files.pythonhosted.org/packages/fa/ab/bc8c3f064791fa7c09e9a1ad3ca49574287c27db98452c7fd41c148d5482/pcpxlog-0.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "6dc107a0b3c55c8c9208ac01f7658421", "sha256": "aabd39efc488ca597e486d17cd557351d72e8638122227aa0b8311de58197c60" }, "downloads": -1, "filename": "pcpxlog-0.1.tar.gz", "has_sig": false, "md5_digest": "6dc107a0b3c55c8c9208ac01f7658421", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3", "size": 12152, "upload_time": "2019-05-06T02:19:44", "url": "https://files.pythonhosted.org/packages/5f/19/32869b6b52e45892ce76d8f67a3a6b8ac4faa8c76f70f9fb7c6e8436e03e/pcpxlog-0.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "5e37c70c66ccd19acf5fdb210d46b221", "sha256": "bb02edc5158b1e7fd0c8b01524dc7bd8c1842a0c4ec011bd4b1b143010ab5e76" }, "downloads": -1, "filename": "pcpxlog-0.1-py3-none-any.whl", "has_sig": false, "md5_digest": "5e37c70c66ccd19acf5fdb210d46b221", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3", "size": 16654, "upload_time": "2019-05-06T02:19:42", "url": "https://files.pythonhosted.org/packages/fa/ab/bc8c3f064791fa7c09e9a1ad3ca49574287c27db98452c7fd41c148d5482/pcpxlog-0.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "6dc107a0b3c55c8c9208ac01f7658421", "sha256": "aabd39efc488ca597e486d17cd557351d72e8638122227aa0b8311de58197c60" }, "downloads": -1, "filename": "pcpxlog-0.1.tar.gz", "has_sig": false, "md5_digest": "6dc107a0b3c55c8c9208ac01f7658421", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3", "size": 12152, "upload_time": "2019-05-06T02:19:44", "url": "https://files.pythonhosted.org/packages/5f/19/32869b6b52e45892ce76d8f67a3a6b8ac4faa8c76f70f9fb7c6e8436e03e/pcpxlog-0.1.tar.gz" } ] }