{ "info": { "author": "Mike Thornton", "author_email": "six8@devdetails.com", "bugtrack_url": null, "classifiers": [ "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Programming Language :: Python", "Programming Language :: Python :: 2.6", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.2", "Programming Language :: Python :: 3.3", "Topic :: Software Development :: Libraries :: Python Modules" ], "description": "==============\nlogging-levels\n==============\n\n.. image:: https://travis-ci.org/six8/logging-levels.png\n :target: https://travis-ci.org/six8/logging-levels\n\nAs projects get bigger, ``logging.debug()`` becomes the dumping\nground for everything that your application is doing. This usually\nbecomes so noisy that you can't really make sense of what you're\ntrying to debug.\n\nAlthough it is usually disabled in production, sometimes you need to\nenable debug logging to -- you know -- actually debug something. But\nsince *everything* is dumped there, it's too much of a mess to wade\nthrough.\n\nTo help with this, you can add extra logging levels. However, rarely\nare they added to projects and when they are, they're often incomplete.\nThen sometimes you go to other projects and they're not there. So you\nhave to lookup how to add them but usually give up and just stick with\ndumping something in ``logging.debug()`` cause you'll remove it later\n-- right?\n\nWhat if it was as easy as 2 lines of code to add a new log level?\n\nBam!:\n\n.. code:: python\n\n from logging_levels import add_log_level\n add_log_level(VERBOSE=9)\n\nHow about a few new log levels?:\n\n.. code:: python\n\n add_log_level(VERBOSE=9, TRACE=8, NOISE=5, IMPORTANT=100)\n\nNow log with them:\n\n.. code:: python\n\n log.verbose(\"I've said too much\")\n log.trace(\"But I haven't said enough\")\n log.noise(\"That's me in the corner\")\n log.important(\"That's me in the spotlight\")\n\nWant to implicitly log exceptions with your fancy new log level?:\n\n.. code:: python\n\n add_log_level(DANG=90, exceptions=True)\n\n try:\n raise Exception('Oops')\n except:\n # Will include exception in log\n log.dang('Something broke.')\n\n\nProject Loggers\n---------------\n\nBy defualt, logging_levels manipulates the global logging module.\nFor your projects -- especially if you're creating open source\nmodules -- you should isolate your logging module.\n\n.. code:: python\n\n from logging_levels import isolated_logging, log_exceptions\n\n logging = isolated_logging(\n STUFF=8,\n THINGS=22,\n WTF=log_exceptions(1000),\n )\n\n logging.stuff('Log some stuff')\n logging.wtf('Log some exceptions')\n\nIf you create this isolated logging module\nin ``mylib/__init__.py``, then you can use it throughout your\nproject easily.\n\n.. code:: python\n\n from mylib import logging\n logging.error('Oops, broke something.')\n\n\nStandards\n---------\n\nTo help everyone standardize on the same log levels, this library\nprovides a function to add some missing severity levels defined by the\nthe syslog protocol in `RFC-5424 `_.\n\nThis library also introduces some additional debugging levels and a\n``SUPPRESSED`` level which is intended to be used for logging suppressed\nexceptions that you may want to log, but otherwise consider handled.\n\nUse the function ``add_standards`` to add the standard levels provided\nby logging-levels:\n\n.. code:: python\n\n from logging_levels.standards import add_standards\n import logging\n add_standards(logging)\n\n log.emergency('This aggression will not stand, man.')\n log.alert('Oh no! Something happened!')\n log.notice('FYI this other thing happened.')\n log.verbose('Debug, but so much more')\n log.trace('Log every -- single -- detail')\n log.suppressed('Warn a suppressed exception')\n\n\nAll levels after using ``add_standards`` will be (new levels are bolded):\n\n+---------------+---------------+\n| Level | Numeric Value |\n+===============+===============+\n| **EMERGENCY** | **100** |\n+---------------+---------------+\n| **ALERT** | **70** |\n+---------------+---------------+\n| CRITICAL | 50 |\n+---------------+---------------+\n| ERROR | 40 |\n+---------------+---------------+\n| **SUPPRESSED**| **31** |\n+---------------+---------------+\n| WARNING | 30 |\n+---------------+---------------+\n| **NOTICE** | **25** |\n+---------------+---------------+\n| INFO | 20 |\n+---------------+---------------+\n| DEBUG | 10 |\n+---------------+---------------+\n| **VERBOSE** | **7** |\n+---------------+---------------+\n| **TRACE** | **5** |\n+---------------+---------------+\n| NOTSET | 0 |\n+---------------+---------------+\n\n\nInstalling\n----------\n\n.. code-block:: console\n\n pip install logging_levels\n\nTesting\n-------\n\nInstall dev requirements:\n\n.. code-block:: console\n\n pip install -r test.requirements.txt\n\nInstall project:\n\n.. code-block:: console\n\n pip install -e .\n\nRun pytest:\n\n.. code-block:: console\n\n py.test tests", "description_content_type": null, "docs_url": null, "download_url": "https://github.com/six8/logging-levels", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/six8/logging-levels", "keywords": "logging", "license": "MIT", "maintainer": null, "maintainer_email": null, "name": "logging_levels", "package_url": "https://pypi.org/project/logging_levels/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/logging_levels/", "project_urls": { "Download": "https://github.com/six8/logging-levels", "Homepage": "https://github.com/six8/logging-levels" }, "release_url": "https://pypi.org/project/logging_levels/0.3.0/", "requires_dist": null, "requires_python": null, "summary": "Add convenient logging levels for when DEBUG just isn't enough.", "version": "0.3.0" }, "last_serial": 2593237, "releases": { "0.3.0": [ { "comment_text": "", "digests": { "md5": "dae79d4b552dbe456816435767af25db", "sha256": "d3afbe447abfca6a3e2307edbe13711541a2b13f09365cba01f240201c18ea2c" }, "downloads": -1, "filename": "logging_levels-0.3.0.tar.gz", "has_sig": false, "md5_digest": "dae79d4b552dbe456816435767af25db", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7769, "upload_time": "2017-01-23T16:59:24", "url": "https://files.pythonhosted.org/packages/30/21/ee133e405b8cf646d1b73cad2d19962def1001acfac7d6a04a20b806a0fc/logging_levels-0.3.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "dae79d4b552dbe456816435767af25db", "sha256": "d3afbe447abfca6a3e2307edbe13711541a2b13f09365cba01f240201c18ea2c" }, "downloads": -1, "filename": "logging_levels-0.3.0.tar.gz", "has_sig": false, "md5_digest": "dae79d4b552dbe456816435767af25db", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7769, "upload_time": "2017-01-23T16:59:24", "url": "https://files.pythonhosted.org/packages/30/21/ee133e405b8cf646d1b73cad2d19962def1001acfac7d6a04a20b806a0fc/logging_levels-0.3.0.tar.gz" } ] }