{ "info": { "author": "Wojciech Kozlowski", "author_email": "wk@wojciechkozlowski.eu", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Intended Audience :: Developers", "License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Topic :: Software Development :: Debuggers" ], "description": "PyLg\n====\n\nPyLg (read as py-log) is a python module that facilitates the process\nof writing runtime logs. The goal of PyLg is to provide an unobtrusive\nand flexible interface that automates the process of generating\ninformative logs.\n\nDemo\n----\n\n.. image:: https://gitlab.wojciechkozlowski.eu/wojtek/PyLg/raw/pylg-dev/screenshots/demo.png\n :target: https://gitlab.wojciechkozlowski.eu/wojtek/PyLg/raw/pylg-dev/screenshots/demo.png\n\nFeatures\n--------\n\n- Ease of use - the API consists of only one decorator and one\n function.\n- Flexible - the user can set global preferences as well as on a\n per-function basis.\n- Informative - PyLg can automatically log input arguments, return\n values and exceptions raised.\n- User logs - the user can make additional logs that will be collected\n together with the automatically generated logs.\n\nInstallation\n------------\n\n::\n\n [sudo] pip install pylg --upgrade\n\nNote that PyLg is under active development. Frequent upgrades are\nrecommended.\n\nUsage\n-----\n\nImport the module:\n\n::\n\n from pylg import TraceFunction, trace\n\nTo automatically log function entry and exit use the\n``@TraceFunction`` decorator:\n\n::\n\n @TraceFunction\n def some_fuction():\n pass\n\nDespite the name, this works for both functions and methods.\n\n``@TraceFunction`` can take up to seven optional arguments:\n\n- ``exception_warning`` - if ``True``, PyLg will print a warning about\n every exception caught to ``stderr``.\n\n- ``exception_tb_file`` - if ``True``, PyLg will write the exception\n tracebacks to the log file.\n\n- ``exception_tb_stderr`` - if ``True``, PyLg will print the exception\n tracebacks to ``stderr``.\n\n- ``exception_exit`` - if ``True``, PyLg will force the program to\n exit (and not just raise SystemExit) whenever an exception\n occurs. This will happen even if the exception would be handled at a\n later point.\n\n- ``trace_args`` - if ``True``, PyLg will log input parameters.\n\n- ``trace_rv`` - if ``True``, PyLg will log return values.\n\n- ``trace_rv_type`` - if ``True``, PyLg will log return value types.\n\nThe default values for these arguments are set in a global settings\nfile.\n\nThese arguments have to specified explicitly by name. Some examples:\n\n::\n\n @TraceFunction(trace_args = False)\n def some_fuction():\n pass\n\n @TraceFunction(trace_args = False, exception_tb_stderr = True)\n def some_fuction():\n pass\n\nThe other way to interact with PyLg is to log a user defined message\nwith the ``trace`` function.\n\n::\n\n trace(\"The user can pass any string they desire in here\")\n\nUser Settings\n-------------\n\nThe user can adjust several settings to suit their preferences. To do\nso, create a file named ``pylg_settings.py`` somewhere in your path\nand set any of the following variables to the desired values in order\nto override the defaults. The settings.py file in the project\ndirectory contains all the default settings and can be used as a\ntemplate.\n\n- ``PYLG_ENABLE`` (default = ``True``) - enable/disable PyLg.\n\n- ``PYLG_FILE`` (default = ``'pylg.log'``) - the log file name.\n\n- ``DEFAULT_EXCEPTION_WARNING`` (default = ``True``) - the default\n setting for ``exception_warning``.\n\n- ``DEFAULT_EXCEPTION_TB_FILE`` (default = ``True``) - the default\n setting for ``exception_tb_file``.\n\n- ``DEFAULT_EXCEPTION_TB_STDERR`` (default = ``False``) - the default\n setting for ``exception_tb_stderr``.\n\n- ``DEFAULT_EXCEPTION_EXIT`` (default = ``False``) - the default\n setting for ``exception_exit``.\n\n- ``TRACE_TIME`` (default = ``TRUE``) - enable/disable time logging.\n\n- ``TIME_FORMAT`` (default = ``\"%Y-%m-%d %H:%M:%S.%f\"``) - formatting\n for the time trace. For a full list of options, see\n https://docs.python.org/2/library/datetime.html#strftime-strptime-behavior.\n\n- ``TRACE_FILENAME`` (default = ``True``) - enable/disable file name\n logging.\n\n- ``FILENAME_COLUMN_WIDTH`` (default = ``20``) - the column width for\n the file name. If a name is too long, it will be truncated.\n\n- ``TRACE_LINENO`` (default = ``True``) - enable/disable the logging\n of the line number from which the trace call was made. For entry and\n exit messages this logs the line in which the decorator is placed\n (which should be directly above the function itself).\n\n- ``LINENO_WIDTH`` (default = ``4``) - the minimum number of digits to\n use to print the line number. If the number is too long, more digits\n will be used.\n\n- ``TRACE_FUNCTION`` (default = ``True``) - enable/disable the logging\n of the function name from which the trace call was made. Entry/exit\n logs refer to the function they enter into and exit from.\n\n- ``FUNCTION_COLUMN_WIDTH`` (default = ``32``) - the column width for\n the function name. If a name is too long, it will be truncated.\n\n- ``CLASS_NAME_RESOLUTION`` (default = ``False``) - enable/disable\n class name resolution. Function names will be printed with their\n class names. IMPORTANT: If this setting is enabled, the trace\n function should ONLY be called from within functions that have the\n ``@TraceFunction`` decorator OR outside of any function.\n\n- ``TRACE_MESSAGE`` (default = ``True``) - enable/disable message\n logging.\n\n- ``MESSAGE_WIDTH`` (default = ``0``) - the column width for the\n message. A width of zero means unlimited.\n\n- ``MESSAGE_WRAP`` (default = ``True``) - if ``True``, PyLg will wrap\n the message to fit within the column width. Otherwise, the message\n will be truncated.\n\n- ``MESSAGE_MARK_TRUNCATION`` (default = ``True``) - if ``True``,\n truncated message lines should have the last character replaced with\n ``\\``. Note that this reduces ``MESSAGE_WIDTH`` by ``1`` for\n truncated lines which may truncate words that would've otherwise\n appeared in the message.\n\n- ``TRACE_SELF`` (default = ``False``) - enable/disable logging of the\n ``self`` function argument.\n\n- ``COLLAPSE_LISTS`` (default = ``False``) - if ``True`` lists will be\n collapsed to ``[ len=x ]`` where ``x`` denotes the number of\n elements in the list.\n\n- ``COLLAPSE_DICTS`` (default = ``False``) - if ``True`` dictionaries\n will be collapsed to ``{ len=x }`` where ``x`` denotes the number of\n elements in the dictionary.\n\n- ``DEFAULT_TRACE_ARGS`` (default = ``True``) - the default setting\n for ``trace_args``.\n\n- ``DEFAULT_TRACE_RV`` (default = ``True``) - the default setting for\n ``trace_rv``.\n\n- ``DEFAULT_TRACE_RV_TYPE`` (default = ``True``) - the default setting\n for ``trace_rv_type``.\n\nUnder development\n-----------------\n\nSince this module is under development, here are a few things to keep\nin mind when using PyLg.\n\n- The behaviour of ``@TraceFunction`` has not been tested when multiple\n decorators are present.\n- When PyLg opens a new log file, it overwrites any file present with\n the same name. Therefore, it can erase important files if you are\n not careful.\n- Some features of PyLg do not work with old-style classes.\n\nContributing\n------------\n\nPlease submit contributions branched from the ``pylg-dev`` branch.\n\n\n", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://gitlab.wojciechkozlowski.eu/wojtek/PyLg", "keywords": "development log debug trace", "license": "", "maintainer": "", "maintainer_email": "", "name": "PyLg", "package_url": "https://pypi.org/project/PyLg/", "platform": "", "project_url": "https://pypi.org/project/PyLg/", "project_urls": { "Homepage": "https://gitlab.wojciechkozlowski.eu/wojtek/PyLg" }, "release_url": "https://pypi.org/project/PyLg/1.3.3/", "requires_dist": null, "requires_python": "", "summary": "Python module to facilitate and automate the process of writing runtime logs.", "version": "1.3.3" }, "last_serial": 5607267, "releases": { "1.1.0": [ { "comment_text": "", "digests": { "md5": "1ee61a7b0ed6bf60ccffc3bb0727bfaa", "sha256": "45be130e806afd4f8dd4ab008156365695e56d31d33ef9b2d26aeaa0a0706cf6" }, "downloads": -1, "filename": "PyLg-1.1.0.tar.gz", "has_sig": false, "md5_digest": "1ee61a7b0ed6bf60ccffc3bb0727bfaa", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 21254, "upload_time": "2017-03-05T23:11:11", "url": "https://files.pythonhosted.org/packages/06/d9/1760a5f93d119ea1053dc8f966f7fb9d79e4535e52bfbc0dc6eb9cf4e66f/PyLg-1.1.0.tar.gz" } ], "1.2.0": [ { "comment_text": "", "digests": { "md5": "d92737c14b2160ef99047aeb0662a22b", "sha256": "49cd2b46974bf534fb91c60eafe289e9558c86618f33bbee4dd8927b0ddcb4f6" }, "downloads": -1, "filename": "PyLg-1.2.0.tar.gz", "has_sig": false, "md5_digest": "d92737c14b2160ef99047aeb0662a22b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 25867, "upload_time": "2017-03-09T00:06:24", "url": "https://files.pythonhosted.org/packages/e3/0a/63e9736b42839cd0ad7ea764efbc98ec097e6e002a6a1083e0c7a2e43ed4/PyLg-1.2.0.tar.gz" } ], "1.2.1": [ { "comment_text": "", "digests": { "md5": "83ebc91bb3555d3571ca41dddf1aaf3e", "sha256": "472c473293ae3535f50a5fb5bba3f9a2c75705ee84a2f72a7dca7c0563a83d8a" }, "downloads": -1, "filename": "PyLg-1.2.1.tar.gz", "has_sig": false, "md5_digest": "83ebc91bb3555d3571ca41dddf1aaf3e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 25914, "upload_time": "2017-03-14T22:08:19", "url": "https://files.pythonhosted.org/packages/3d/ec/9b697255da5975e182f972c89870ac9591ae765c670131ce327be65f123d/PyLg-1.2.1.tar.gz" } ], "1.2.2": [ { "comment_text": "", "digests": { "md5": "5292489738cd573bf80c24e98bf185ea", "sha256": "4411d411fcd1331f2ae1191ae8000c0bac82cb780277aff4caf861fb1e5e22b7" }, "downloads": -1, "filename": "PyLg-1.2.2.tar.gz", "has_sig": false, "md5_digest": "5292489738cd573bf80c24e98bf185ea", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 25945, "upload_time": "2017-03-14T22:29:59", "url": "https://files.pythonhosted.org/packages/39/62/364bdca1a0f5080ed89aecb1178c6a7cccfb4b3c4dba53f813884516ecde/PyLg-1.2.2.tar.gz" } ], "1.3.0": [ { "comment_text": "", "digests": { "md5": "76fc6bbc00d3cd2be7c7afd1c6b5e4b2", "sha256": "42c2b6ec50fe1017ca590d9dc09c7451d3f70eaa2ddcac548964cdc47ef0078b" }, "downloads": -1, "filename": "PyLg-1.3.0.tar.gz", "has_sig": false, "md5_digest": "76fc6bbc00d3cd2be7c7afd1c6b5e4b2", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 26860, "upload_time": "2017-03-16T23:14:37", "url": "https://files.pythonhosted.org/packages/ec/22/550bd6ff8ff33683d06a51b8a7318084b14029bd02ba9894def30c5f0cef/PyLg-1.3.0.tar.gz" } ], "1.3.1": [ { "comment_text": "", "digests": { "md5": "eabedab07c2b656ceb9f7d85c170ed88", "sha256": "ec7d47bd69fc83eff46cb247561ffe85b72e9b158111c9cf2d55664f6fd6ac27" }, "downloads": -1, "filename": "PyLg-1.3.1.tar.gz", "has_sig": false, "md5_digest": "eabedab07c2b656ceb9f7d85c170ed88", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 26850, "upload_time": "2017-03-16T23:23:29", "url": "https://files.pythonhosted.org/packages/ee/d6/d0417af1f1c6b6fcc044720bd861858374051deb665af8a75a0f897bc594/PyLg-1.3.1.tar.gz" } ], "1.3.2": [ { "comment_text": "", "digests": { "md5": "1aec0e9cc8c17db3a54fb5651c17037e", "sha256": "47630e688f09794110bdbe6c118ca8f7384f289c997e17e50554a3b6826e7687" }, "downloads": -1, "filename": "PyLg-1.3.2.tar.gz", "has_sig": false, "md5_digest": "1aec0e9cc8c17db3a54fb5651c17037e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 26093, "upload_time": "2018-01-17T21:01:21", "url": "https://files.pythonhosted.org/packages/65/c7/ef55a5ccc2b9c889d08e8c5d31ad21556fc362d970cd45f6842a4695c756/PyLg-1.3.2.tar.gz" } ], "1.3.3": [ { "comment_text": "", "digests": { "md5": "d652508e7296d34490fe533dd30ce748", "sha256": "498908f1582ffcdba5ac073bc4bb7d1d817be3bb4426253850c9eda09af58e0a" }, "downloads": -1, "filename": "PyLg-1.3.3-py3-none-any.whl", "has_sig": false, "md5_digest": "d652508e7296d34490fe533dd30ce748", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 27371, "upload_time": "2019-07-30T11:44:44", "url": "https://files.pythonhosted.org/packages/6c/15/20e454f122d87e4088803be527de8566468608c55645b573f702e11cb63c/PyLg-1.3.3-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "a629b39422235e74523b0976f4fdd67c", "sha256": "9c4977dae1465f0e96b8d68b5299af68ebd785f196605a810a453ac0973e8dc0" }, "downloads": -1, "filename": "PyLg-1.3.3.tar.gz", "has_sig": false, "md5_digest": "a629b39422235e74523b0976f4fdd67c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 27321, "upload_time": "2019-07-30T11:44:46", "url": "https://files.pythonhosted.org/packages/d3/6e/9146cbcbdf36911ef1c63b0ef82cb2bd6e7de50e42f6c2c389aa2584b9f5/PyLg-1.3.3.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "d652508e7296d34490fe533dd30ce748", "sha256": "498908f1582ffcdba5ac073bc4bb7d1d817be3bb4426253850c9eda09af58e0a" }, "downloads": -1, "filename": "PyLg-1.3.3-py3-none-any.whl", "has_sig": false, "md5_digest": "d652508e7296d34490fe533dd30ce748", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 27371, "upload_time": "2019-07-30T11:44:44", "url": "https://files.pythonhosted.org/packages/6c/15/20e454f122d87e4088803be527de8566468608c55645b573f702e11cb63c/PyLg-1.3.3-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "a629b39422235e74523b0976f4fdd67c", "sha256": "9c4977dae1465f0e96b8d68b5299af68ebd785f196605a810a453ac0973e8dc0" }, "downloads": -1, "filename": "PyLg-1.3.3.tar.gz", "has_sig": false, "md5_digest": "a629b39422235e74523b0976f4fdd67c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 27321, "upload_time": "2019-07-30T11:44:46", "url": "https://files.pythonhosted.org/packages/d3/6e/9146cbcbdf36911ef1c63b0ef82cb2bd6e7de50e42f6c2c389aa2584b9f5/PyLg-1.3.3.tar.gz" } ] }