{ "info": { "author": "Kyle Verhoog", "author_email": "kyle@verhoog.ca", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Environment :: Console", "Intended Audience :: Developers", "Intended Audience :: Information Technology", "Intended Audience :: System Administrators", "License :: OSI Approved :: MIT License", "Operating System :: MacOS", "Operating System :: Microsoft :: Windows", "Operating System :: POSIX", "Operating System :: Unix", "Programming Language :: Python", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.6", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: Implementation :: CPython", "Programming Language :: Python :: Implementation :: PyPy", "Topic :: Communications", "Topic :: Scientific/Engineering :: Human Machine Interfaces", "Topic :: Software Development", "Topic :: Software Development :: Libraries :: Python Modules", "Topic :: Software Development :: User Interfaces", "Topic :: System", "Topic :: System :: Console Fonts", "Topic :: System :: Logging", "Topic :: System :: Shells", "Topic :: System :: Systems Administration", "Topic :: System :: System Shells", "Topic :: Terminals", "Topic :: Utilities" ], "description": "colouredlogs: Coloured terminal output for Python's logging module\n==================================================================\n\nNOTE: This is a parody of the great `python-colouredlogs`_ project\nby Peter Odding. Please use that package as I currently have no\nplans to maintain this one. All I've done is `s/color/colour/g`.\n\n.. _`python-colouredlogs`: https://github.com/xolox/python-coloredlogs\n\nThe `colouredlogs` package enables coloured terminal output for Python's logging_\nmodule. The ColouredFormatter_ class inherits from `logging.Formatter`_ and uses\n`ANSI escape sequences`_ to render your logging messages in colour. It uses only\nstandard colours so it should work on any UNIX terminal. It's currently tested\non Python 2.6, 2.7, 3.4, 3.5, 3.6 and PyPy. On Windows `colouredlogs`\nautomatically pulls in Colourama_ as a dependency and enables ANSI escape\nsequence translation using Colourama. Here is a screen shot of the demo that is\nprinted when the command ``colouredlogs --demo`` is executed:\n\n\n.. image:: https://colouredlogs.readthedocs.io/en/latest/_images/defaults.png\n\nNote that the screenshot above includes custom logging levels defined by my\nverboselogs_ package: if you install both `colouredlogs` and `verboselogs` it\nwill Just Work (`verboselogs` is of course not required to use\n`colouredlogs`).\n\n.. contents::\n :local:\n\nInstallation\n------------\n\nThe `colouredlogs` package is available on PyPI_ which means installation should\nbe as simple as:\n\n.. code-block:: sh\n\n $ pip install colouredlogs\n\nThere's actually a multitude of ways to install Python packages (e.g. the `per\nuser site-packages directory`_, `virtual environments`_ or just installing\nsystem wide) and I have no intention of getting into that discussion here, so\nif this intimidates you then read up on your options before returning to these\ninstructions ;-).\n\nUsage\n-----\n\nHere's an example of how easy it is to get started:\n\n.. code-block:: python\n\n import colouredlogs, logging\n\n # Create a logger object.\n logger = logging.getLogger(__name__)\n\n # By default the install() function installs a handler on the root logger,\n # this means that log messages from your code and log messages from the\n # libraries that you use will all show up on the terminal.\n colouredlogs.install(level='DEBUG')\n\n # If you don't want to see log messages from libraries, you can pass a\n # specific logger object to the install() function. In this case only log\n # messages originating from that logger will show up on the terminal.\n colouredlogs.install(level='DEBUG', logger=logger)\n\n # Some examples.\n logger.debug(\"this is a debugging message\")\n logger.info(\"this is an informational message\")\n logger.warning(\"this is a warning message\")\n logger.error(\"this is an error message\")\n logger.critical(\"this is a critical message\")\n\nFormat of log messages\n----------------------\n\nThe ColouredFormatter_ class supports user defined log formats so you can use\nany log format you like. The default log format is as follows::\n\n %(asctime)s %(hostname)s %(name)s[%(process)d] %(levelname)s %(message)s\n\nThis log format results in the following output::\n\n 2015-10-23 03:32:22 peter-macbook colouredlogs.demo[30462] DEBUG message with level 'debug'\n 2015-10-23 03:32:23 peter-macbook colouredlogs.demo[30462] VERBOSE message with level 'verbose'\n 2015-10-23 03:32:24 peter-macbook colouredlogs.demo[30462] INFO message with level 'info'\n ...\n\nYou can customize the log format and styling using environment variables as\nwell as programmatically, please refer to the `online documentation`_ for\ndetails.\n\nEnabling millisecond precision\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\nIf you're switching from `logging.basicConfig()`_ to `colouredlogs.install()`_\nyou may notice that timestamps no longer include milliseconds. This is because\ncolouredlogs doesn't output milliseconds in timestamps unless you explicitly\ntell it to. There are three ways to do that:\n\n1. The easy way is to pass the `milliseconds` argument to `colouredlogs.install()`_::\n\n colouredlogs.install(milliseconds=True)\n\n This became supported in `release 7.1`_ (due to `#16`_).\n\n2. Alternatively you can change the log format `to include 'msecs'`_::\n\n %(asctime)s,%(msecs)03d %(hostname)s %(name)s[%(process)d] %(levelname)s %(message)s\n\n Here's what the call to `colouredlogs.install()`_ would then look like::\n\n colouredlogs.install(fmt='%(asctime)s,%(msecs)03d %(hostname)s %(name)s[%(process)d] %(levelname)s %(message)s')\n\n Customizing the log format also enables you to change the delimiter that\n separates seconds from milliseconds (the comma above). This became possible\n in `release 3.0`_ which added support for user defined log formats.\n\n3. If the use of ``%(msecs)d`` isn't flexible enough you can instead add ``%f``\n to the date/time format, it will be replaced by the value of ``%(msecs)03d``.\n Support for the ``%f`` directive was added to `release 9.3`_ (due to `#45`_).\n\nChanging text styles and colours\n--------------------------------\n\nThe online documentation contains `an example of customizing the text styles and\ncolours `_.\n\nColoured output from cron\n-------------------------\n\nWhen `colouredlogs` is used in a cron_ job, the output that's e-mailed to you by\ncron won't contain any ANSI escape sequences because `colouredlogs` realizes\nthat it's not attached to an interactive terminal. If you'd like to have colours\ne-mailed to you by cron there are two ways to make it happen:\n\n.. contents::\n :local:\n\nModifying your crontab\n~~~~~~~~~~~~~~~~~~~~~~\n\nHere's an example of a minimal crontab::\n\n MAILTO=\"your-email-address@here\"\n CONTENT_TYPE=\"text/html\"\n * * * * * root colouredlogs --to-html your-command\n\nThe ``colouredlogs`` program is installed when you install the `colouredlogs`\nPython package. When you execute ``colouredlogs --to-html your-command`` it runs\n``your-command`` under the external program ``script`` (you need to have this\ninstalled). This makes ``your-command`` think that it's attached to an\ninteractive terminal which means it will output ANSI escape sequences which\nwill then be converted to HTML by the ``colouredlogs`` program. Yes, this is a\nbit convoluted, but it works great :-)\n\nModifying your Python code\n~~~~~~~~~~~~~~~~~~~~~~~~~~\n\nThe ColouredCronMailer_ class provides a context manager that automatically\nenables HTML output when the ``$CONTENT_TYPE`` variable has been correctly set\nin the crontab.\n\nThis requires my capturer_ package which you can install using ``pip install\n'colouredlogs[cron]'``. The ``[cron]`` extra will pull in capturer_ 2.4 or newer\nwhich is required to capture the output while silencing it - otherwise you'd\nget duplicate output in the emails sent by ``cron``.\n\nThe context manager can also be used to retroactively silence output that has\nalready been produced, this can be useful to avoid spammy cron jobs that have\nnothing useful to do but still email their output to the system administrator\nevery few minutes :-).\n\nContact\n-------\n\nThe latest version of `colouredlogs` is available on PyPI_ and GitHub_. The\n`online documentation`_ is available on Read The Docs and includes a\nchangelog_. For bug reports please create an issue on GitHub_. If you have\nquestions, suggestions, etc. feel free to send me an e-mail at\n`peter@peterodding.com`_.\n\nLicense\n-------\n\nThis software is licensed under the `MIT license`_.\n\n\u00a9 2018 Peter Odding.\n\n\n.. External references:\n.. _#16: https://github.com/xolox/python-coloredlogs/issues/16\n.. _#45: https://github.com/xolox/python-coloredlogs/issues/45\n.. _ANSI escape sequences: https://en.wikipedia.org/wiki/ANSI_escape_code#Colors\n.. _capturer: https://pypi.python.org/pypi/capturer\n.. _changelog: https://colouredlogs.readthedocs.org/en/latest/changelog.html\n.. _Colourama: https://pypi.python.org/pypi/colorama\n.. _ColouredCronMailer: https://colouredlogs.readthedocs.io/en/latest/api.html#colouredlogs.converter.ColouredCronMailer\n.. _ColouredFormatter: https://colouredlogs.readthedocs.io/en/latest/api.html#colouredlogs.ColouredFormatter\n.. _colouredlogs.install(): https://colouredlogs.readthedocs.io/en/latest/api.html#colouredlogs.install\n.. _cron: https://en.wikipedia.org/wiki/Cron\n.. _GitHub: https://github.com/kyle-verhoog/python-colouredlogs\n.. _logging.basicConfig(): https://docs.python.org/2/library/logging.html#logging.basicConfig\n.. _logging.Formatter: https://docs.python.org/2/library/logging.html#logging.Formatter\n.. _logging: https://docs.python.org/2/library/logging.html\n.. _MIT license: https://en.wikipedia.org/wiki/MIT_License\n.. _online documentation: https://colouredlogs.readthedocs.io/\n.. _per user site-packages directory: https://www.python.org/dev/peps/pep-0370/\n.. _peter@peterodding.com: peter@peterodding.com\n.. _PyPI: https://pypi.python.org/pypi/colouredlogs\n.. _release 3.0: https://colouredlogs.readthedocs.io/en/latest/changelog.html#release-3-0-2015-10-23\n.. _release 7.1: https://colouredlogs.readthedocs.io/en/latest/changelog.html#release-7-1-2017-07-15\n.. _release 9.3: https://colouredlogs.readthedocs.io/en/latest/changelog.html#release-9-3-2018-04-29\n.. _to include 'msecs': https://stackoverflow.com/questions/6290739/python-logging-use-milliseconds-in-time-format\n.. _verboselogs: https://pypi.python.org/pypi/verboselogs\n.. _virtual environments: http://docs.python-guide.org/en/latest/dev/virtualenvs/\n\n\n", "description_content_type": "text/x-rst", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://colouredlogs.readthedocs.io", "keywords": "", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "colouredlogs", "package_url": "https://pypi.org/project/colouredlogs/", "platform": "", "project_url": "https://pypi.org/project/colouredlogs/", "project_urls": { "Homepage": "https://colouredlogs.readthedocs.io" }, "release_url": "https://pypi.org/project/colouredlogs/10.0.1/", "requires_dist": [ "humanfriendly (==4.7)", "colorama ; sys_platform == \"win32\"", "capturer (>=2.4) ; extra == 'cron'" ], "requires_python": "", "summary": "Coloured terminal output for Python's logging module", "version": "10.0.1" }, "last_serial": 5527778, "releases": { "10.0": [ { "comment_text": "", "digests": { "md5": "611e0bd07bbc5bab80ae875ea8b9e6b8", "sha256": "7c4f6d7b9d228c50b29bb348dc2bee237cdd66c79ae0899e8ba0baefa306dd78" }, "downloads": -1, "filename": "colouredlogs-10.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "611e0bd07bbc5bab80ae875ea8b9e6b8", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 43848, "upload_time": "2019-07-13T08:22:05", "url": "https://files.pythonhosted.org/packages/71/b3/8004cab0a63ecf688a3d151e6d78bc1bcc670f75107c3c25f807394923f1/colouredlogs-10.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "55e7f0ff2c6663dc22cf0dacc9c19884", "sha256": "6c267317e9bfc8f4d71f6d88cc654c529711f872649426258ced792e85b31942" }, "downloads": -1, "filename": "colouredlogs-10.0.tar.gz", "has_sig": false, "md5_digest": "55e7f0ff2c6663dc22cf0dacc9c19884", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 272791, "upload_time": "2019-07-13T08:22:07", "url": "https://files.pythonhosted.org/packages/29/f4/091ce5a453d1ab3af1f83dc522a7edf006bd2c71aa63810814af6c018902/colouredlogs-10.0.tar.gz" } ], "10.0.1": [ { "comment_text": "", "digests": { "md5": "61568f90db654d6b3ca80b4fd4e6b96c", "sha256": "2fe1cb555c0d065baf81de4003da4fd87095117ab43de788aade0d8b69766108" }, "downloads": -1, "filename": "colouredlogs-10.0.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "61568f90db654d6b3ca80b4fd4e6b96c", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 43903, "upload_time": "2019-07-13T20:17:45", "url": "https://files.pythonhosted.org/packages/75/53/fe47f29a355f90e424f853a4c8c0c379d0e01a038f8643d2ca5416418f7f/colouredlogs-10.0.1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "0c0949f0e2d39040b7a483db2f499e2b", "sha256": "cbf6ebea0da0e977315026ac369e534a2bce669c4d21c77243d6d7bf0f0d56cb" }, "downloads": -1, "filename": "colouredlogs-10.0.1.tar.gz", "has_sig": false, "md5_digest": "0c0949f0e2d39040b7a483db2f499e2b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 272944, "upload_time": "2019-07-13T20:17:47", "url": "https://files.pythonhosted.org/packages/28/db/0cfca46d92e80649e63038ec414658c2917217265a20a7cac87498df8580/colouredlogs-10.0.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "61568f90db654d6b3ca80b4fd4e6b96c", "sha256": "2fe1cb555c0d065baf81de4003da4fd87095117ab43de788aade0d8b69766108" }, "downloads": -1, "filename": "colouredlogs-10.0.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "61568f90db654d6b3ca80b4fd4e6b96c", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 43903, "upload_time": "2019-07-13T20:17:45", "url": "https://files.pythonhosted.org/packages/75/53/fe47f29a355f90e424f853a4c8c0c379d0e01a038f8643d2ca5416418f7f/colouredlogs-10.0.1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "0c0949f0e2d39040b7a483db2f499e2b", "sha256": "cbf6ebea0da0e977315026ac369e534a2bce669c4d21c77243d6d7bf0f0d56cb" }, "downloads": -1, "filename": "colouredlogs-10.0.1.tar.gz", "has_sig": false, "md5_digest": "0c0949f0e2d39040b7a483db2f499e2b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 272944, "upload_time": "2019-07-13T20:17:47", "url": "https://files.pythonhosted.org/packages/28/db/0cfca46d92e80649e63038ec414658c2917217265a20a7cac87498df8580/colouredlogs-10.0.1.tar.gz" } ] }