{ "info": { "author": "Ingo Heimbach", "author_email": "i.heimbach@fz-juelich.de", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Environment :: Console", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Operating System :: MacOS", "Operating System :: POSIX :: Linux", "Programming Language :: Python", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3 :: Only", "Topic :: Software Development", "Topic :: Utilities" ], "description": "# YACL - Yet Another Color Logger\n\n## Overview\n\nYACL is a very simple to use color logger for Python intended to be used for stderr logging. It can be set up with a\nsingle function call in existing projects and enables colored logging output with reasonable defaults. Colors are\ndisabled automatically if stderr is not connected to a tty (e.g. on file redirection) or if not supported by the\nconnected terminal. Currently, Linux and macOS are supported.\n\nYou can use Markdown style formattings to produce bold and italic text. Additionally, text enclosed in double\nunderscores will be displayed underlined. YACL checks the terminal capabilities and automatically disables unsupported\nformats.\n\n## Installation\n\nYACL is available on PyPI for Python 3.3+ and can be installed with `pip`:\n\n```bash\npython3 -m pip install yacl\n```\n\n## Usage\n\n### Simple\n\nCall ``setup_colored_stderr_logging`` after the root logger has been set up, for example:\n\n```python\n#!/usr/bin/env python3\n\nimport logging\nfrom yacl import setup_colored_stderr_logging\n\n\ndef main():\n logging.basicConfig(level=logging.DEBUG)\n setup_colored_stderr_logging()\n\n\nif __name__ == \"__main__\":\n main()\n```\n\nAfterwards, get module level loggers and use them without any further configuration:\n\n```python\nimport logging\n\n\nlogger = logging.getLogger(__name__)\n\n\ndef my_func():\n logger.debug('Failed to open file \"abc\"')\n```\n\nYou will get an output like:\n\n![screenshot_simple](https://raw.githubusercontent.com/IngoHeimbach/yacl/master/simple.png)\n\nThis example only works if you don't attach any output handlers to loggers other than the root logger as recommended in\nthe [Python logging documentation](https://docs.python.org/3/library/logging.html):\n\n> If you attach a handler to a logger and one or more of its ancestors, it may emit the same record multiple times. In\n> general, you should not need to attach a handler to more than one logger - if you just attach it to the appropriate\n> logger which is highest in the logger hierarchy, then it will see all events logged by all descendant loggers,\n> provided that their propagate setting is left set to True. A common scenario is to attach handlers only to the root\n> logger, and to let propagation take care of the rest.\n\n### Customization\n\nYou can pass several arguments to the `setup_colored_stderr_logging` function to customize the logging behavior:\n\n- `logger`: The logger which will be configured to print colored logging output to stderr. By default, the root logger\n is used.\n\n- `format_string`: The format string to use for logging messages. By default the logging format\n `[%(levelname)s] (%(name)s:%(lineno)s:%(funcName)s): %(message)s` is used.\n\n **Important**: All formats must be passed as **string types**. For example, in the default format, ``lineno`` is given\n as string (`(%lineno)s`) and not as number (`(%lineno)d`).\n\n- `remove_other_handlers`: Bool flag to remove all other output handlers on the given logger. Is set to `true` by\n default to avoid duplicate logging messages.\n\n- `attribute_colors`: A dictionary which assigns colors to logging attributes (which are used in the logging format\n string). This dictionary is merged with the internal defaults:\n\n ```python\n from yacl import TerminalColorCodes\n\n _attribute_colors = {\n \"funcName\": TerminalColorCodes.blue,\n \"lineno\": TerminalColorCodes.yellow,\n \"name\": TerminalColorCodes.cyan,\n }\n ```\n\n- `keyword_colors`: A dictionary which assigns colors to a given regular expressions. This setting can be used to\n highlight expressions in the logging messages. This dictionary is merged with the internal defaults:\n\n ```python\n from yacl import TerminalColorCodes\n\n keyword_colors = {\n r\"\\bcritical( error)?\\b\": TerminalColorCodes.red + TerminalColorCodes.blink + TerminalColorCodes.bold,\n r\"\\bdebug(ged|ging)?\\b\": TerminalColorCodes.green + TerminalColorCodes.bold,\n r\"\\berror\\b\": TerminalColorCodes.red + TerminalColorCodes.bold,\n r\"\\bfail(ed|ing)?\\b\": TerminalColorCodes.red + TerminalColorCodes.bold,\n r\"\\binfo\\b\": TerminalColorCodes.blue + TerminalColorCodes.bold,\n r\"\\bwarn(ed|ing)?\\b\": TerminalColorCodes.yellow + TerminalColorCodes.bold,\n r'\"[^\"]*\"': TerminalColorCodes.yellow,\n r\"\\*([^*]+)\\*\": TerminalColorCodes.italics,\n r\"\\*\\*([^*]+)\\*\\*\": TerminalColorCodes.bold,\n r\"__([^_]+)__\": TerminalColorCodes.underline,\n r\"`([^`]+)`\": TerminalColorCodes.standout,\n }\n ```\n\n Example: Pass a dictionary\n\n ```python\n {\n r\"'[^']*'\": TerminalColorCodes.green + TerminalColorCodes.italics,\n }\n ```\n\n to highlight strings in single quotes with green color and italic font (if supported by the Terminal).\n\n- `level_colors`: A dictionary which assigns colors to logging levels (DEBUG, INFO, ...). This dictionary is merged with\n the internal defaults:\n\n ```python\n from yacl import TerminalColorCodes\n\n level_colors = {\n \"DEBUG\": TerminalColorCodes.green + TerminalColorCodes.bold,\n \"INFO\": TerminalColorCodes.blue + TerminalColorCodes.bold,\n \"WARNING\": TerminalColorCodes.yellow + TerminalColorCodes.bold,\n \"ERROR\": TerminalColorCodes.red + TerminalColorCodes.bold,\n \"CRITICAL\": TerminalColorCodes.red + TerminalColorCodes.blink + TerminalColorCodes.bold,\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/IngoHeimbach/yacl", "keywords": "utility,logging,color", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "yacl", "package_url": "https://pypi.org/project/yacl/", "platform": "", "project_url": "https://pypi.org/project/yacl/", "project_urls": { "Homepage": "https://github.com/IngoHeimbach/yacl" }, "release_url": "https://pypi.org/project/yacl/0.3.1/", "requires_dist": null, "requires_python": "~=3.3", "summary": "YACL (Yet Another Color Logger) is a simple to use color logger for Python programs.", "version": "0.3.1" }, "last_serial": 5741699, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "d803d09f8bbcda0d97cd8c96d0116d47", "sha256": "83763c4bf02ee62c4c952fc84cfccac1b7a5c59842a75246495b400f86cda1e0" }, "downloads": -1, "filename": "yacl-0.1.0-py3-none-any.whl", "has_sig": false, "md5_digest": "d803d09f8bbcda0d97cd8c96d0116d47", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": "~=3.3", "size": 5407, "upload_time": "2019-08-12T07:08:35", "url": "https://files.pythonhosted.org/packages/de/b4/9dd60103e89e25f3193447112353fab0c4919bcc1d73d23045d8fa143ad6/yacl-0.1.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "bfaf2c62c5604836056e34b47efcb30a", "sha256": "5c311f55c5090f0aa2c801be2b639e6bbb48afd67ea762a5bba8e1378033b4d5" }, "downloads": -1, "filename": "yacl-0.1.0.tar.gz", "has_sig": false, "md5_digest": "bfaf2c62c5604836056e34b47efcb30a", "packagetype": "sdist", "python_version": "source", "requires_python": "~=3.3", "size": 5525, "upload_time": "2019-08-12T07:08:37", "url": "https://files.pythonhosted.org/packages/88/98/045a57616e47b37f446fb6124616f8de567ea678bb7748fdb23c81651164/yacl-0.1.0.tar.gz" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "569762bb28ecc835f27cdc0a43b69ecd", "sha256": "8ded8ffeb1e90df2b830ec04a2f99e3f4a77905d2a76bc32f24cf371ea530f90" }, "downloads": -1, "filename": "yacl-0.1.1-py3-none-any.whl", "has_sig": false, "md5_digest": "569762bb28ecc835f27cdc0a43b69ecd", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": "~=3.3", "size": 5412, "upload_time": "2019-08-12T07:51:43", "url": "https://files.pythonhosted.org/packages/fe/44/54d6f591cb3528aa6d224cb3a3007eeb8c7853c27620c5b8f2c210f06c2c/yacl-0.1.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "546a866c9f6db82222bb2fecf2d06547", "sha256": "fb6f2caf1fd7fa73f3f8a51479622cd770f1dd48bd2cedcad42d5b2cf1c6d9f1" }, "downloads": -1, "filename": "yacl-0.1.1.tar.gz", "has_sig": false, "md5_digest": "546a866c9f6db82222bb2fecf2d06547", "packagetype": "sdist", "python_version": "source", "requires_python": "~=3.3", "size": 5545, "upload_time": "2019-08-12T07:51:45", "url": "https://files.pythonhosted.org/packages/56/8f/26aa624ba4aff46c97341e6625d81a945b4f2d5082317bd924e2486743b5/yacl-0.1.1.tar.gz" } ], "0.1.2": [ { "comment_text": "", "digests": { "md5": "89bb787d35a57db31c773109b1ad11b3", "sha256": "0094975b61f51a55820315fa53972c4f17cc3994287ed3a1fc5eb92a06ea6bc4" }, "downloads": -1, "filename": "yacl-0.1.2-py3-none-any.whl", "has_sig": false, "md5_digest": "89bb787d35a57db31c773109b1ad11b3", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": "~=3.3", "size": 5420, "upload_time": "2019-08-12T13:23:46", "url": "https://files.pythonhosted.org/packages/7c/62/0d22579e743fc7af729b3a5026d39670905823430c9d6a2e718cc5789948/yacl-0.1.2-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "6b6198bdc475d5fc25d28a35b93fd3ff", "sha256": "e68f1f52e28bce3e18da5d78a4dcc689c58990e2c73e05a351b85e2b5dca8f13" }, "downloads": -1, "filename": "yacl-0.1.2.tar.gz", "has_sig": false, "md5_digest": "6b6198bdc475d5fc25d28a35b93fd3ff", "packagetype": "sdist", "python_version": "source", "requires_python": "~=3.3", "size": 5544, "upload_time": "2019-08-12T13:23:48", "url": "https://files.pythonhosted.org/packages/5f/16/1af7de401afd9a388093b4fd0bb25e6d7e28c44888f05c4e8b0aa87fe9ca/yacl-0.1.2.tar.gz" } ], "0.1.3": [ { "comment_text": "", "digests": { "md5": "10270538fbecb6c1865908964430846b", "sha256": "b4a98e8a27cef7017bdfe436b5e9464aa5b11367e69eec3a620b70d57226af25" }, "downloads": -1, "filename": "yacl-0.1.3-py3-none-any.whl", "has_sig": false, "md5_digest": "10270538fbecb6c1865908964430846b", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": "~=3.3", "size": 5425, "upload_time": "2019-08-12T13:48:42", "url": "https://files.pythonhosted.org/packages/26/4d/fa397c11717fcab6489629c83a01124c3204e4e89a8ac6a4648aeb9f7181/yacl-0.1.3-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "c53f0169fd2d0fcf4c608c8511bf7a60", "sha256": "4b6bfda17a9077ed6775834f36f5d2252d05f9a04de4a6b1a85e75d19d7261e0" }, "downloads": -1, "filename": "yacl-0.1.3.tar.gz", "has_sig": false, "md5_digest": "c53f0169fd2d0fcf4c608c8511bf7a60", "packagetype": "sdist", "python_version": "source", "requires_python": "~=3.3", "size": 5549, "upload_time": "2019-08-12T13:48:43", "url": "https://files.pythonhosted.org/packages/4c/90/cd5db82caec9a6a8db6e861bc61330cd17d7b1fcc5e20a0c9747b6ab6839/yacl-0.1.3.tar.gz" } ], "0.2.0": [ { "comment_text": "", "digests": { "md5": "18dcef863b783d8e59b942435072a794", "sha256": "372ee388a0031f685012e10a1e2bee780fa58406aebf11d87eb2546f1d627c1e" }, "downloads": -1, "filename": "yacl-0.2.0-py3-none-any.whl", "has_sig": false, "md5_digest": "18dcef863b783d8e59b942435072a794", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": "~=3.3", "size": 6555, "upload_time": "2019-08-14T09:07:34", "url": "https://files.pythonhosted.org/packages/2a/38/58c1c81b1a27edb592b99879b4552dfa0672aae24dd7ad9da54b6284c844/yacl-0.2.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "d69eb2e7709b7be2db32ac469f0af9b6", "sha256": "9491c113f78137d9aeca6c923a41b67389c6d501af30cc346c0145e63024996f" }, "downloads": -1, "filename": "yacl-0.2.0.tar.gz", "has_sig": false, "md5_digest": "d69eb2e7709b7be2db32ac469f0af9b6", "packagetype": "sdist", "python_version": "source", "requires_python": "~=3.3", "size": 6718, "upload_time": "2019-08-14T09:07:35", "url": "https://files.pythonhosted.org/packages/07/9f/5c6724a5ddeb6a337ec2bf4038ebd93ff1a5ac900bb0e2759745f5729743/yacl-0.2.0.tar.gz" } ], "0.3.0": [ { "comment_text": "", "digests": { "md5": "665b2ac1733b347d7d71b4a28993a7cf", "sha256": "c87f01d716060df98de266ba28f3c0f6f3c36a3f3f72f3d0522c01183c5e9d79" }, "downloads": -1, "filename": "yacl-0.3.0-py3-none-any.whl", "has_sig": false, "md5_digest": "665b2ac1733b347d7d71b4a28993a7cf", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": "~=3.3", "size": 6557, "upload_time": "2019-08-28T09:59:04", "url": "https://files.pythonhosted.org/packages/6c/ed/d812e87f378c0d34d37e6401118f307e9888f93c19dede4bc60d7019f96a/yacl-0.3.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "39eca6832cde8e24ae37514932307f4c", "sha256": "352b63489e68884cbedd0026ebbbf6c7181b2ce1c82ca70d111fac9f71133575" }, "downloads": -1, "filename": "yacl-0.3.0.tar.gz", "has_sig": false, "md5_digest": "39eca6832cde8e24ae37514932307f4c", "packagetype": "sdist", "python_version": "source", "requires_python": "~=3.3", "size": 6725, "upload_time": "2019-08-28T09:59:06", "url": "https://files.pythonhosted.org/packages/09/97/1804638e9360c64ba27b966e1196d6b318a8a6a6f0b220f37b2f6477ae9d/yacl-0.3.0.tar.gz" } ], "0.3.1": [ { "comment_text": "", "digests": { "md5": "8d349e90639f0c86adac2fba0c950a47", "sha256": "3c575d81c3ae8c339ce503c71e584238a5500c65148d9ca10b38d72bf4a00c76" }, "downloads": -1, "filename": "yacl-0.3.1-py3-none-any.whl", "has_sig": false, "md5_digest": "8d349e90639f0c86adac2fba0c950a47", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": "~=3.3", "size": 6562, "upload_time": "2019-08-28T10:04:28", "url": "https://files.pythonhosted.org/packages/7c/1e/0ef61f69876398b2bdfff46712336d08f54beb7127dfa91c167c974be5dc/yacl-0.3.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "06323089bb737eaae906f528b78d9e75", "sha256": "3c62a2c81937755ebf32252eb027b11318bb0b1c82a9bfe2380a821355b772ee" }, "downloads": -1, "filename": "yacl-0.3.1.tar.gz", "has_sig": false, "md5_digest": "06323089bb737eaae906f528b78d9e75", "packagetype": "sdist", "python_version": "source", "requires_python": "~=3.3", "size": 6727, "upload_time": "2019-08-28T10:04:29", "url": "https://files.pythonhosted.org/packages/d7/a3/54645fa59d4eee03bc075a040162ac9973775052f1562f99b03266293882/yacl-0.3.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "8d349e90639f0c86adac2fba0c950a47", "sha256": "3c575d81c3ae8c339ce503c71e584238a5500c65148d9ca10b38d72bf4a00c76" }, "downloads": -1, "filename": "yacl-0.3.1-py3-none-any.whl", "has_sig": false, "md5_digest": "8d349e90639f0c86adac2fba0c950a47", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": "~=3.3", "size": 6562, "upload_time": "2019-08-28T10:04:28", "url": "https://files.pythonhosted.org/packages/7c/1e/0ef61f69876398b2bdfff46712336d08f54beb7127dfa91c167c974be5dc/yacl-0.3.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "06323089bb737eaae906f528b78d9e75", "sha256": "3c62a2c81937755ebf32252eb027b11318bb0b1c82a9bfe2380a821355b772ee" }, "downloads": -1, "filename": "yacl-0.3.1.tar.gz", "has_sig": false, "md5_digest": "06323089bb737eaae906f528b78d9e75", "packagetype": "sdist", "python_version": "source", "requires_python": "~=3.3", "size": 6727, "upload_time": "2019-08-28T10:04:29", "url": "https://files.pythonhosted.org/packages/d7/a3/54645fa59d4eee03bc075a040162ac9973775052f1562f99b03266293882/yacl-0.3.1.tar.gz" } ] }