{ "info": { "author": "Ryan Miller", "author_email": "ryan@devopsmachine.com", "bugtrack_url": null, "classifiers": [ "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python :: 2", "Programming Language :: Python :: 3", "Topic :: System :: Logging" ], "description": "#############\nconlog\n#############\n\n|build-status| |license| |pypi-version|\n\nAnti-Boilerplate Console Logging Module for Python\n\n\nAbout\n=====\n\n*conlog* is a configurable console logging mechanism featuring:\n\n- Boilerplate-free setup\n- Only one line per Logger\n- Export to optional rotating log file\n- Show additional log columns when debugging, suppress when not\n- YAML or argument based configuration\n\n\nInstallation\n============\n\nInstall via pip: **(Recommended)**\n::\n\n pip install conlog\n\nOr with setup_tools:\n::\n\n python setup.py install\n\n\nDocumentation\n=============\n\nQuick start\n-----------\n\n::\n\n import conlog\n log = conlog.start(level='INFO')\n log.info('Hello World!')\n\n\nFunctions\n---------\n\n\nstart(...)\n\"\"\"\"\"\"\"\"\"\"\n\n::\n\n start(\n yaml_file=None,\n log_file=None,\n log_format='%(asctime)22s - %(levelname)8s - %(name)20s - %(message)s',\n debug_format='%(asctime)22s - %(levelname)8s - %(name)20s - %(funcName)20s - %(message)s',\n level='INFO',\n max_file_size='5000000',\n max_retention=5\n )\n\nConfigure and return the root Logger instance. All parameters\nare optional. If any parameter is not supplied, its default\nvalue be used. It is even possible to run with no parameters,\nin which case the default values would be used across all\noptions.\n\nParameters\n''''''''''\n\n:``yaml_file``:\n Pull configurations from YAML file. All parameters from\n ``start()`` are available as YAML options. Option entries\n should be nested under ``conlog`` at the root of the YAML\n file. The file should be structured:\n ::\n\n conlog:\n log_file: log/app.log\n log_format: '%(asctime)22s - %(levelname)8s - %(name)20s - %(message)s'\n debug_format: '%(asctime)22s - %(levelname)8s - %(name)20s - %(funcName)20s - %(message)s'\n level: INFO\n max_file_size: 5 MB\n max_retention: 5\n\n Like ``start()`` parameters, all YAML settings are optional.\n If any setting is not supplied in the configuration, its\n default value will be used.\n\n If ``yaml_file`` is supplied, its values are processed first,\n and will be overridden by any additional parameters called in\n ``start()``\n\n Default: ``None``\n\n\n:``log_file``:\n Path to log file. By default, file logging is disabled. If\n ``log_file`` is set to a file path, for example, ``log/app.log``,\n it will enable rotating file logging.\n\n NOTE: In the example ``log/app.log``, the log file itself,\n ``app.log``, does not need to exist; however, the base directory\n ``log`` MUST exist.\n\n By default the log file will rotate when it reaches ``5 MB``,\n with up to ``5`` rotations being kept before overwriting the oldest.\n These values can be adjusted using the ``max_file_size`` and\n ``max_retention`` options.\n\n Default: ``None``\n\n\n:``log_format``:\n Logging format for all levels EXCEPT ``DEBUG``.\n\n Default: ``%(asctime)22s - %(levelname)8s - %(name)20s - %(message)s``\n\n\n:``debug_format``:\n Logging format for ``DEBUG`` level. By default, this displays the\n same formatting as ``format``, but with an additional column for\n the function name which is calling the Logger.\n\n Default: ``%(asctime)22s - %(levelname)8s - %(name)20s - %(funcName)20s - %(message)s``\n\n\n:``level``:\n Logging level. Only messages sent to this level or higher will\n appear in log.\n\n Default: ``INFO``\n\n\n:``max_file_size``:\n Maximum log file size before rollover. This value can either\n be an integer byte size or a proper string like: ``5 MB``,\n ``50 kB``, etc. Setting to ``0`` will cause the log file to\n grow infinitely with no rollover. This option has no impact if\n ``log_file`` is set to ``None``.\n\n Default: ``5000000`` (5 MB)\n\n\n:``max_retention``:\n Maximum number of rollover logs to keep. Rotated logs will be\n saved in the format ``log_name.1``, ``log_name.2``, etc.,\n until ``max_retention`` is reached. At that point the oldest\n of the rollover logs will be purged. This option has no impact\n if ``log_file`` is set to ``None``, or if ``max_file_size`` is\n set to ``0``.\n\n Default: ``5``\n\n\nnew(inst)\n\"\"\"\"\"\"\"\"\"\nGet a new Logger instance for the calling class. Recommended\nusage is ``self.log = conlog.new(self)``.\n\nParameters\n''''''''''\n\n:``inst``:\n Instance of class which new Logger is for, (HINT: use ``self``)\n\n **Required**\n\n\nExamples\n========\n\nThis is the easiest way to add a root Logger using conlog with ``INFO`` level\nlogging to the console.\n::\n\n log = conlog.start(level='INFO')\n\nStart logging based on configuration in the YAML file, ``conf/conlog.yml``.\n::\n\n log = conlog.start(yaml_file='conf/conlog.yml')\n\n\nStart ``DEBUG`` level Logger with console logging and rotating file logging to\n``logs/app.log``.\n::\n\n log = conlog.start(\n log_file='logs/app.log',\n level='DEBUG'\n )\n\nSimilar to above but with specific values set for rotation of log files. This\nwill rotate the log file when it reaches ``1 MB`` and retain up to ``10``\narchived log files before overwriting the oldest.\n::\n\n log = conlog.start(\n log_file='log/app.log',\n level='INFO',\n max_file_size='1 MB',\n max_retention=10,\n )\n\nStart console logging with a different log format.\n::\n\n log = conlog.start(log_format='%(levelname)s:%(name)s:%(message)s')\n\n\nGet a Logger instance for a class. (Remember to ``start()`` first)\n::\n\n class Example(object):\n def __init__(self):\n self.log = conlog.new(self)\n\n\nAuthor\n======\n* Ryan Miller - ryan@devopsmachine.com\n\n.. |build-status| image:: https://img.shields.io/travis/RyanMillerC/conlog.svg?branch=master\n :alt: Build Status\n :scale: 100%\n :target: https://travis-ci.org/RyanMillerC/conlog\n\n.. |license| image:: https://img.shields.io/github/license/ryanmillerc/conlog.svg\n :alt: License\n :scale: 100%\n :target: https://github.com/RyanMillerC/conlog/blob/master/LICENSE.txt\n\n.. |pypi-version| image:: https://img.shields.io/pypi/v/conlog.svg\n :alt: PyPi Version\n :scale: 100%\n :target: https://pypi.org/project/conlog", "description_content_type": "", "docs_url": null, "download_url": "https://github.com/RyanMillerC/conlog/archive/1.1.3.tar.gz", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/RyanMillerC/conlog", "keywords": "logging,debugging", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "conlog", "package_url": "https://pypi.org/project/conlog/", "platform": "", "project_url": "https://pypi.org/project/conlog/", "project_urls": { "Download": "https://github.com/RyanMillerC/conlog/archive/1.1.3.tar.gz", "Homepage": "https://github.com/RyanMillerC/conlog" }, "release_url": "https://pypi.org/project/conlog/1.1.3/", "requires_dist": null, "requires_python": "", "summary": "Anti-Boilerplate Console Logging Module for Python", "version": "1.1.3" }, "last_serial": 4140039, "releases": { "1.1.0": [ { "comment_text": "", "digests": { "md5": "d2d245c6dd4267c5eb1e96b727edab69", "sha256": "b624b6105050562c9616b5715ea414f5d0c1b62ce760593a631d36330d0e1787" }, "downloads": -1, "filename": "conlog-1.1.0.tar.gz", "has_sig": false, "md5_digest": "d2d245c6dd4267c5eb1e96b727edab69", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5727, "upload_time": "2018-07-24T18:06:09", "url": "https://files.pythonhosted.org/packages/ca/e8/55d59f59c1954245f2df847acb2c4e881c9ac0ef6574290c65bce002c880/conlog-1.1.0.tar.gz" } ], "1.1.3": [ { "comment_text": "", "digests": { "md5": "441f02835b4d1232ab69ba34e36b069c", "sha256": "c0c0d1cff41835a4c1ed39dfa73dbd5ff03088b39c226c800e246356d292d62c" }, "downloads": -1, "filename": "conlog-1.1.3.tar.gz", "has_sig": false, "md5_digest": "441f02835b4d1232ab69ba34e36b069c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6285, "upload_time": "2018-08-06T12:03:14", "url": "https://files.pythonhosted.org/packages/57/89/e5d30552d7de19537edb94b5ad8abda68788a713b243bbcf04ad66497034/conlog-1.1.3.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "441f02835b4d1232ab69ba34e36b069c", "sha256": "c0c0d1cff41835a4c1ed39dfa73dbd5ff03088b39c226c800e246356d292d62c" }, "downloads": -1, "filename": "conlog-1.1.3.tar.gz", "has_sig": false, "md5_digest": "441f02835b4d1232ab69ba34e36b069c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6285, "upload_time": "2018-08-06T12:03:14", "url": "https://files.pythonhosted.org/packages/57/89/e5d30552d7de19537edb94b5ad8abda68788a713b243bbcf04ad66497034/conlog-1.1.3.tar.gz" } ] }