{ "info": { "author": "Ryan Miller", "author_email": "ryan@devopsmachine.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 3 - Alpha", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python :: 2", "Programming Language :: Python :: 3", "Topic :: System :: Logging" ], "description": "#############\nclogging\n#############\n\nclogging - Configurable Logging Boilerplate for the Autologging Module. \n\nAbout\n************\n\nAutologging (https://github.com/mzipay/Autologging) is an awesome module for\nautomatic logging in Python; however, it's not completely boilerplate free.\n\nThis module, clogging, addresses tasks that I would otherwise need to address\nper application I build.\n\nIt features:\n\n* Complete setup of a complex root Logger instance with a single call\n* Configurable logging through YAML configuration or through keyword args\n* Detailed output columns for lower logging levels\n* Suppressed output columns for higher logging levels\n* Optional rotating file handler\n\nA demo \"Hello World\" application using clogging/autologging is available here,\n https://github.com/RyanMillerC/DemoCloggingApp\n\n*Technically clogging could be used to configure the standard Python\nlogging module, since this doesn't directly interact with autologging,\nbut it was specifically created to fill in gaps and save me time\nbuilding applications that use autologging.*\n\nInstallation\n************\n \n::\n\n pip install clogging\n\n\nDocumentation\n*************\n\nImport this module with:\n::\n\n import clogging\n\nThese are the two functions which will start logging.\n\nstart_from_yaml\n~~~~~~~~~~~~~~~\n\nUsage:\n::\n\n log = clogging.start_from_yaml('path/to/file.yaml')\n\nStart logging based on entries in a YAML configuration file. This is\ndesigned to work with an existing application settings.yaml file, but\ndoes not have to have anything additional for your application inside\nit. All clogging entries should be nested under 'clogging' at the root\nof the YAML file. If this is unclear, look at the example in the demo\napplication mentioned previous in this document.\n\nThis function returns a root Logger instance.\n\nYour YAML file, at it's root level, should be structured like,\n::\n\n\n clogging:\n file: log/app.log\n format: '%(asctime)22s - %(levelname)8s - %(name)20s - %(message)s'\n format_ext: '%(asctime)22s - %(levelname)8s - %(name)20s - \\\n %(funcName)20s - %(message)s'\n level: INFO\n max_file_size: 5 MB\n max_retention: 5\n verbose_levels: ['TRACE', 'DEBUG']\n app: // Application or other configurations not necessary, shown\n ... // here for example only\n ...\n\nAll YAML settings are optional. If any setting is not supplied in the\nconfiguration, it's default value will be used. For a list of available\noptions and defaults, see the Options section below.\n\nTo use clogging without a YAML file, see below.\n\nstart_from_args\n~~~~~~~~~~~~~~~\n\nUsage:\n::\n\n log = clogging.start_from_args(\n file='log/app.log',\n format='%(asctime)22s - %(levelname)8s - %(name)20s - %(message)s',\n format_ext='%(asctime)22s - %(levelname)8s - %(name)20s - ' \\\n '%(funcName)20s - %(message)s',\n level='INFO',\n max_file_size='5 MB',\n max_retention=5,\n verbose_levels=['TRACE', 'DEBUG']\n )\n\n\nStart logging based on keyword arguments. This function will accept the\nsame options names and values as start_from_yaml.\n\nThis function returns a root Logger instance.\n\nAll arguments are optional. If any argument is not supplied, it's default\nvalue be used. It is even possible to run with 0 arguments, in which case\nthe default values would be used for everything.\n\nFor a list of available arguments and default values, see the Options\nsection below.\n\nThis example is the easiest way to add clogging into a project and start\nINFO level logging to the console,\n::\n\n log = clogging.start_from_args(level='INFO')\n\nOr, another example to start DEBUG level logging with a rotating file handler,\n::\n\n log = clogging.start_from_args(\n file='logs/app.log',\n level='DEBUG'\n )\n\n\nOptions\n~~~~~~~\n\nThe following are available options and their descriptions. If any of\nthese options are not supplied, the default value will be used. These\noption names can be set in either YAML format or as keyword arguments\nfor start_from_args.\n\n:file:\n Path to log file. By default, file logging is disabled. If 'file' is set to a\n file path, for example, 'log/app.log', it will enable rotating file logging. \n\n Note: In the example 'log/app.log', the log file itself, 'app.log', does not\n need to exist; however, the base directory 'log' MUST exist. \n \n By default the log file will rotate when it reaches 5 MB, with up to 5\n rotations being kept before overwriting the oldest. These values can be\n configured using 'max_file_size' and 'max_retention'.\n\n Default: None\n\n:format:\n Logging format for all non-verbose levels. By default non-verbose is\n considered to be INFO and higher.\n\n Default: '%(asctime)22s - %(levelname)8s - %(name)20s - %(message)s'\n\n:format_ext:\n Logging format for all verbose levels. By default this is considered\n to be DEBUG and TRACE levels. Additional levels can be added to use this\n format in 'verbose_levels'.\n \n Default: '%(asctime)22s - %(levelname)8s - %(name)20s - %(funcName)20s - %(message)s'\n\n:level:\n Logging level.\n\n Default: 'INFO'\n\n:max_file_size:\n Maximum log file size before rollover. This value can either be an integer\n byte size or a proper string like: \"5 MB\", \"50 kB\", etc. Setting to 0\n will cause the log file to grow infinitely with no rollover. This option has\n no impact if 'file' is set to None.\n\n Default: '5 MB'\n\n:max_retention:\n Maximum number of rollover logs to keep. Logs will be saved as log.1, log.2,\n ...etc., until max_retention is reached. At that point the oldest of\n the rollover logs will be purged. This option has no impact if 'file' is set\n to None, or if 'max_file_size' is set to 0.\n\n Default: 5\n\n:verbose_levels:\n Logging levels in this list are considered verbose levels and will use\n format_ext for formatting. This is typically done to follow low\n level logs which show funcName alongside name.\n \n Default: ['TRACE', 'DEBUG']\n\nAuthor\n************\n* Ryan Miller - ryan@devopsmachine.com\n", "description_content_type": "", "docs_url": null, "download_url": "https://github.com/RyanMillerC/clogging/archive/0.3.tar.gz", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/RyanMillerC/clogging", "keywords": "logging", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "clogging", "package_url": "https://pypi.org/project/clogging/", "platform": "", "project_url": "https://pypi.org/project/clogging/", "project_urls": { "Download": "https://github.com/RyanMillerC/clogging/archive/0.3.tar.gz", "Homepage": "https://github.com/RyanMillerC/clogging" }, "release_url": "https://pypi.org/project/clogging/0.3/", "requires_dist": null, "requires_python": "", "summary": "Configurable Logging Boilerplate for the Autologging Module", "version": "0.3" }, "last_serial": 3804059, "releases": { "0.1": [ { "comment_text": "", "digests": { "md5": "8589b28ce8007af0bfae6ddf6bdfb1c8", "sha256": "e75e2f6ebd81c97d9da709dc29f79ca58324f03bd0737272f73515945c1e06b5" }, "downloads": -1, "filename": "clogging-0.1.tar.gz", "has_sig": false, "md5_digest": "8589b28ce8007af0bfae6ddf6bdfb1c8", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4363, "upload_time": "2018-04-20T11:35:30", "url": "https://files.pythonhosted.org/packages/bb/3e/a8a9a52c15637dc7ee7ba10e1b910b60e92a92f8df01068b07512253bcd5/clogging-0.1.tar.gz" } ], "0.2": [ { "comment_text": "", "digests": { "md5": "ab3bda7157a3f5f816be7c4b13d4d99b", "sha256": "d207a58caa2370772822ab18ed07e79bc3e4048f41e9eab6c9b187cf083571eb" }, "downloads": -1, "filename": "clogging-0.2.tar.gz", "has_sig": false, "md5_digest": "ab3bda7157a3f5f816be7c4b13d4d99b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4507, "upload_time": "2018-04-20T19:01:36", "url": "https://files.pythonhosted.org/packages/7a/af/33ecb4ab4c0a037d13926832f3345a8e68086f01b524a5ee802e68344eb9/clogging-0.2.tar.gz" } ], "0.3": [ { "comment_text": "", "digests": { "md5": "30dbb3cd3b0ff94db1730b78deb2f8c3", "sha256": "6417edc7db4181ceb2fee58038b17d20d94428d788ee9dd84916989a6f1061f0" }, "downloads": -1, "filename": "clogging-0.3.tar.gz", "has_sig": false, "md5_digest": "30dbb3cd3b0ff94db1730b78deb2f8c3", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5138, "upload_time": "2018-04-24T18:56:50", "url": "https://files.pythonhosted.org/packages/a8/78/ad27aad48975711ec9fac8413c66ab330fa7a250587793bda142b1bd89fc/clogging-0.3.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "30dbb3cd3b0ff94db1730b78deb2f8c3", "sha256": "6417edc7db4181ceb2fee58038b17d20d94428d788ee9dd84916989a6f1061f0" }, "downloads": -1, "filename": "clogging-0.3.tar.gz", "has_sig": false, "md5_digest": "30dbb3cd3b0ff94db1730b78deb2f8c3", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5138, "upload_time": "2018-04-24T18:56:50", "url": "https://files.pythonhosted.org/packages/a8/78/ad27aad48975711ec9fac8413c66ab330fa7a250587793bda142b1bd89fc/clogging-0.3.tar.gz" } ] }