{ "info": { "author": "Niederhauser Lo\u00efc", "author_email": "loic.niederhauser@gmail.com", "bugtrack_url": null, "classifiers": [ "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python :: 3" ], "description": "# PAPAGEI\nPapagei is a module that proposes an implementation for verbose logging. Python has options to do verbose logging, \nerror warning and error handling and so on. However, multiple packages are often implied and implementing the desired \nmessages might require multiple lines of code. Papagei is an attempt to make a module that allows to do verbose logging \nin a simple way without importing multiple packages imports and with a minimal number of lines of code for each call. \nDespite being fairly simple, papagei has the downside of being more rigid. It is good for simple cases and debug. For\nmore complex error handling or message formatting you might want to get back to python built in functions and packages.\n\n## Using papagei\nThere are three major components in papagei:\n- VerboseLevel(Enum) (class)\n- VERBOSE (object of type VerboseLevel)\n- The display functions\n\n### VerboseLevel and verbose:\nIn this implementation papagei has 6 verbose levels:\n- **SILENT:** Nothing will be displayed no errors will be raised no warnings will be returned.\n- **ERROR:** Only mock_errors() are displayed. errors are raised as usual. \n- **WARNINGS:** Errors behave as usual, and warnings and mock_warnings as well.\n- **INFO:** All messages from the previous levels plus the info messages.\n- **DEBUG:** All messages from the previous levels plus the debug messages.\n- **FRIVOLOUS:** All messages from the previous levels plus the frivolity messages.\n\nThe verbose level can be set using the VERBOSE variable and the VerboseLevel enum. For example:\n```python\nVERBOSE = VerboseLevel.INFO\n```\n**NOTE:** Due to its simple implementation the verbose level in papagei only works on the functions \nform the papagei packages. In other words putting papagei.VERBOSE to silent will not silence errors raised outside of \nthe papagei package, won't implement any warning filter to cancel out warnings from outside of the papapgei module and \nwon't obliterate any print() done outside of the papagei module.\n\n### Functions\nAll functions are link to a specific debug level. Two functions are available for the ERROR level and the WARNING level.\nOne uses the actual python warnings and error the other one (preceded by \"mock_\") only print a message in the console \nwithout interrupting the run of the program.\n\n* error(*args): (Level: ERROR) Formats the args into a string and uses it to raise an error.\n* mock_error(*args): (Level: ERROR) Formats the args into a string and prints them in an error-like format.\n* warning(*args, **kwargs): (Level: WARNING) Formats the args into a string and uses it to generate a warning. The \n warning type can be changed by passing a Waring class through the key-word 'type'. The warning is displayed and the\n warning object is returned by the function.\n* mock_warning(*args): (Level: WARNING) Formats the args into a string and displays it into a warning-like format.\n* info(*args): (Level: INFO) Formats the args into a string and displays it into a specific info-format.\n* debug(*args): (Level: DEBUG) Formats the args into a string and displays it into a specific debug-format.\n* frivolity(*args): (Level: FRIVOLOUS) Formats the args into a string and displays it into a specific \n frivolity-format.\n\n### Example\n```python\nfrom papagei import papagei as ppg\nppg.VERBOSE = ppg.VerboseLevel.DEBUG\n\nppg.debug('This is example', 1) # This message will show\nppg.frivolity('This is example', 2) # This won't show\n```\n**NOTE:** The import statement has a slight redundancy in it. This should be fixed later.\n\n## Modifying the source code\nEven if it is not possible to add classes from outside of the package, the source code was made in a way that should \nmake the adding, removing, moving or reformatting class easy.\n\n### Reformatting a class\nThe formatting of a class is done through the text_format dictionary. The value of the dictionary is added before \neach string of the corresponding level to format it. Chang the value in this dictionary to change the formats. \nSame goes for the text_header dictionary which displays a header at the beginning of a message.\n\n### Adding, removing or moving a class\nTo move a class in the hierarchy all that has to be done it to change its position in the VerboseLevel(Enum) enum. \nThis enum is auto-numbered so moving it will adapt the value of the item and the checks in every functions will be \nadapted. To add an item the corresponding VerboseLevel should be added in the enum. Then the text_format and text_header \ndictionaries should be updated. Finally a dedicated function for the new level can be written on the model debug, \ninfo or frivolity, using _format_string_from_tuple(string_tuple) to format *args into a single string. Same process can \nbe followed in reverse to remove a class.\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/niederha/papagei", "keywords": "", "license": "", "maintainer": "", "maintainer_email": "", "name": "papagei-niederha", "package_url": "https://pypi.org/project/papagei-niederha/", "platform": "", "project_url": "https://pypi.org/project/papagei-niederha/", "project_urls": { "Homepage": "https://github.com/niederha/papagei" }, "release_url": "https://pypi.org/project/papagei-niederha/0.0.2/", "requires_dist": null, "requires_python": "", "summary": "A package for easy verbose logging, error and warnings.", "version": "0.0.2" }, "last_serial": 5154705, "releases": { "0.0.2": [ { "comment_text": "", "digests": { "md5": "faab08462252e5874735fba13af25531", "sha256": "09d3c6fd06d5a429976da8ae5864b0c4c28affeab0f03dac47c7ad3f07032b33" }, "downloads": -1, "filename": "papagei_niederha-0.0.2-py3-none-any.whl", "has_sig": false, "md5_digest": "faab08462252e5874735fba13af25531", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 5598, "upload_time": "2019-04-17T11:08:42", "url": "https://files.pythonhosted.org/packages/c7/c4/3ae9d063f084fde7af8bc519fae07434740a5a8b6b9433a96d7b511bf7e5/papagei_niederha-0.0.2-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "49572d20f882738a8924e8792030b50e", "sha256": "52b23821a847365a9c444b97b102cfb602c5159c2956f2748d2610aa8492ac37" }, "downloads": -1, "filename": "papagei-niederha-0.0.2.tar.gz", "has_sig": false, "md5_digest": "49572d20f882738a8924e8792030b50e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4423, "upload_time": "2019-04-17T11:08:44", "url": "https://files.pythonhosted.org/packages/7d/44/4e6e2ffab50c354735ef3d19dcba54f5fdf7dfe99be35034aa846761dd26/papagei-niederha-0.0.2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "faab08462252e5874735fba13af25531", "sha256": "09d3c6fd06d5a429976da8ae5864b0c4c28affeab0f03dac47c7ad3f07032b33" }, "downloads": -1, "filename": "papagei_niederha-0.0.2-py3-none-any.whl", "has_sig": false, "md5_digest": "faab08462252e5874735fba13af25531", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 5598, "upload_time": "2019-04-17T11:08:42", "url": "https://files.pythonhosted.org/packages/c7/c4/3ae9d063f084fde7af8bc519fae07434740a5a8b6b9433a96d7b511bf7e5/papagei_niederha-0.0.2-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "49572d20f882738a8924e8792030b50e", "sha256": "52b23821a847365a9c444b97b102cfb602c5159c2956f2748d2610aa8492ac37" }, "downloads": -1, "filename": "papagei-niederha-0.0.2.tar.gz", "has_sig": false, "md5_digest": "49572d20f882738a8924e8792030b50e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4423, "upload_time": "2019-04-17T11:08:44", "url": "https://files.pythonhosted.org/packages/7d/44/4e6e2ffab50c354735ef3d19dcba54f5fdf7dfe99be35034aa846761dd26/papagei-niederha-0.0.2.tar.gz" } ] }