{ "info": { "author": "Atsuo Ishimoto", "author_email": "", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "License :: OSI Approved :: MIT License", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Topic :: Software Development :: Libraries :: Python Modules" ], "description": "============================\nhappylogging\n============================\n\nUtility functions to help using standard logging module.\n\n\nRequirements\n============\n\n* Python 3.4 or later\n\n\nConfigure logging\n=========================\n\n\ninitlog()\n----------------\n\n``initlog(logger=None, overwrite=True, level=None, format=DEFAULT_FORMAT, propagate=False, filename=None, rotate=None, backups=0, encoding=None, syslog=None, facility=None)``\n\n\n``initlogin()`` configures various logging in a function.\n\n``logger`` is a name of logger or logger instance to configure. If ``logger`` is None or empty string, Root logger is configured. \n\nLogging configuration is overwritten if ``overwrite`` is ``True``. To add handler to the logger instead of replace, ``overwrite`` should be ``False``. \n\n``level`` should be an one of ``'CRITICAL'``, ``'WARNING'``, ``'INFO'``, ``'DEBUG'``.\n\n\nConfigure to logging to files\n+++++++++++++++++++++++++++++++++++++\n\n``filename`` is a comma separated list of file names to emit logs. To print to a stdout, specify ``-`` as filename.\n\n::\n\n import happylogging\n initlog(filename='log.log, -', level='DEBUG') # Logging to log.log and stdout\n\n\n``rotate`` specifies how to log files rotated. \n\n- rotate by size\n\n You can specify size to rotates file such as ``100mb`` or ``2gb``.\n\n::\n\n initlog(filename='log.log', rotate='10mb') # Rotate files every 10 MB.\n\n- rotate by time.\n\n You can specify when to rotate files. Valid values are conbination of interval value and type.\n\n - Digits followed by ``'S'`` specify to rotate every n seconds. e.g. ``100S`` rotates in every 100 seconds. Similary, ``'M'``, ``\"H\"`` and ``\"D\"`` specify Minutes, Hours and Days respecivly.\n\n - To rotate every day, you can specify time to rotate such as ``02:00``.\n\n::\n\n initlog(filename='log.log', rotate='10D') # Rotate files in every 10 Days\n initlog(filename='log.log', rotate='04:30') # Rotate files at 04:30 every day\n\n- If rotate specified, you can also specify number of backups of log file to ``backups`` arg.\n\n::\n\n initlog(filename='log.log', rotate='10D', backups=10) # Retain 10 back ups\n\n- ``encoding`` specifies encoding of log file.\n\n\nConfigure to logging to syslog\n+++++++++++++++++++++++++++++++++++++\n\n\nTo logging to syslog server, you can use ``syslog`` to specify syslog servers as commna separated list of servers. Each servers are apecified as ``HOST:PORT`` form or ``/path/to/udp/port`` form. If ``syslog`` is omitted, ``localhost:514`` is assumed. To logging to syslog, ``facility`` must not be omitted.\n\n\n::\n\n initlog(syslog='/dev/log, example:514', facility='syslog') # Send to local port and host 'example'\n\n::\n\n initlog(filename='-', facility='syslog') # Send to stdout and local syslog server.\n\n\n\nUtility functions\n========================\n\nAfter ``happylogging`` was imported, logging methods such as ``logging.info()`` gains some addtional methods.\n\nblock()/encblock()\n--------------------\n\nDefine indented block of logs.\n\n::\n\n >>> import logging, happylogging\n >>> happylogging.initlog(filename='log.log', level='DEBUG')\n >>> logging.debug('first line')\n >>> logging.debug.block()\n >>> logging.debug('indented!')\n >>> logging.debug.block()\n >>> logging.debug('more indented!')\n >>> logging.debug.endblock()\n >>> logging.debug.endblock()\n >>> logging.debug('no more!')\n >>> print(open('log.log').read())\n 2016-06-19 14:50:01,121 DEBUG first line\n 2016-06-19 14:50:24,225 DEBUG indented!\n 2016-06-19 14:50:35,806 DEBUG more indented!\n 2016-06-19 14:50:56,835 DEBUG no more!\n\nIndent is defined per thread and logging level (CRITICAL, WARNING, ...).\n\nsetcolor(color=None)\n----------------------\n\nChange color of log if log is directed to the tty. ``color`` should be one of string \n``\"RED\"``, ``\"GREEN\"``, ``\"YELLOW\"``, ``\"BLUE\"``, ``\"MAGENTA\"``,``\"CYAN\"``.\n\nTo reset color, specify ``None`` as color.\n\n``setcolor()`` doesn't work if output device is file or syslogs.\n\n::\n\n >>> happylogging.initlog(filename='-', level='DEBUG') # log to console\n >>> logging.debug.setcolor(\"RED\") # Change text color of debug to red.\n >>> logging.debug.setcolor(None) # Restore color\n\n\nCopyright \n=========================\n\nCopyright (c) 2016 Atsuo Ishimoto\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.", "description_content_type": null, "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/atsuoishimoto/happylogging", "keywords": "logging", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "happylogging", "package_url": "https://pypi.org/project/happylogging/", "platform": "", "project_url": "https://pypi.org/project/happylogging/", "project_urls": { "Homepage": "https://github.com/atsuoishimoto/happylogging" }, "release_url": "https://pypi.org/project/happylogging/0.0.6/", "requires_dist": null, "requires_python": "", "summary": "Utility functions to help using standard logging module.", "version": "0.0.6" }, "last_serial": 3164189, "releases": { "0.0.1": [ { "comment_text": "", "digests": { "md5": "8ad94f4e7d26cfe6df61d39b5781030a", "sha256": "7347657bb79924bfbf33f6b9e2eb9d18b5a954dda9660f41523f5fed9b955abe" }, "downloads": -1, "filename": "happylogging-0.0.1.tar.gz", "has_sig": false, "md5_digest": "8ad94f4e7d26cfe6df61d39b5781030a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3644, "upload_time": "2016-12-31T02:49:21", "url": "https://files.pythonhosted.org/packages/dc/5d/6ed638675e1f6f6cf6f42a16dbaf5381b6bf39e011e38914f6cbff7fdead/happylogging-0.0.1.tar.gz" } ], "0.0.2": [ { "comment_text": "", "digests": { "md5": "5c1907930fbbf7a56244c8fb12b1cd92", "sha256": "44675d8c62ed97316d3cf3509f2cd229bbb28b56630526bdcfca4aab54a80e84" }, "downloads": -1, "filename": "happylogging-0.0.2.tar.gz", "has_sig": false, "md5_digest": "5c1907930fbbf7a56244c8fb12b1cd92", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5678, "upload_time": "2016-12-31T09:19:16", "url": "https://files.pythonhosted.org/packages/cb/14/650be65a760665f6d6925fd45a4b873be57378d526ce07540ae6b8954cc0/happylogging-0.0.2.tar.gz" } ], "0.0.3": [ { "comment_text": "", "digests": { "md5": "0fb9ab2c06e783e5a5cbfac8a7f09f69", "sha256": "815c3247a6401f077d0c072f5d643af98381b5648f32e1d77eb36d9ae8d13595" }, "downloads": -1, "filename": "happylogging-0.0.3-py3-none-any.whl", "has_sig": false, "md5_digest": "0fb9ab2c06e783e5a5cbfac8a7f09f69", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 8960, "upload_time": "2017-08-03T12:11:14", "url": "https://files.pythonhosted.org/packages/e1/e3/822f830128a3987fe46034fa4b6e4c6d7a15ba63cd25d8626d4f61aef7a1/happylogging-0.0.3-py3-none-any.whl" } ], "0.0.4": [ { "comment_text": "", "digests": { "md5": "1159607e8c6c036f51911fcab3891176", "sha256": "0a0b7848e5f171c660d96f348ec2e5de0242c6b36670ebead1eecc13de1bf425" }, "downloads": -1, "filename": "happylogging-0.0.4-py3-none-any.whl", "has_sig": false, "md5_digest": "1159607e8c6c036f51911fcab3891176", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 8966, "upload_time": "2017-08-03T12:19:14", "url": "https://files.pythonhosted.org/packages/bf/27/3a4b0767fa7f89506ca070e83575b0b83445c33e54d24e4913ead1427633/happylogging-0.0.4-py3-none-any.whl" } ], "0.0.5": [ { "comment_text": "", "digests": { "md5": "bf098812c71f3440fbeb7e65e7a340a0", "sha256": "ea2c3d6e31625f1367e6ef0a80d758773af47a094f022859d17aa6c96c822274" }, "downloads": -1, "filename": "happylogging-0.0.5.tar.gz", "has_sig": false, "md5_digest": "bf098812c71f3440fbeb7e65e7a340a0", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5622, "upload_time": "2017-09-10T07:25:17", "url": "https://files.pythonhosted.org/packages/da/ad/16048d2ad94db0fa05eca1080b5227b5e5ac686f9f6cdfeafe9a508cf0c4/happylogging-0.0.5.tar.gz" } ], "0.0.6": [ { "comment_text": "", "digests": { "md5": "776ba829d0026ff62eb7cb2770fbffb8", "sha256": "1e378dd299e2e061faf5abc2b1ddcd47da9593c2120cf8c25958dcb7223c094a" }, "downloads": -1, "filename": "happylogging-0.0.6.tar.gz", "has_sig": false, "md5_digest": "776ba829d0026ff62eb7cb2770fbffb8", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5689, "upload_time": "2017-09-11T01:36:25", "url": "https://files.pythonhosted.org/packages/72/65/a32cded5a8995f52cea21c393c5285eda187b382c255c9e894112abd5145/happylogging-0.0.6.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "776ba829d0026ff62eb7cb2770fbffb8", "sha256": "1e378dd299e2e061faf5abc2b1ddcd47da9593c2120cf8c25958dcb7223c094a" }, "downloads": -1, "filename": "happylogging-0.0.6.tar.gz", "has_sig": false, "md5_digest": "776ba829d0026ff62eb7cb2770fbffb8", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5689, "upload_time": "2017-09-11T01:36:25", "url": "https://files.pythonhosted.org/packages/72/65/a32cded5a8995f52cea21c393c5285eda187b382c255c9e894112abd5145/happylogging-0.0.6.tar.gz" } ] }