{ "info": { "author": "Simon Jagoe", "author_email": "simon@simonjagoe.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 1 - Planning", "Intended Audience :: Developers", "License :: OSI Approved :: BSD License", "Programming Language :: Python", "Topic :: Software Development", "Topic :: System :: Logging" ], "description": "============\n graystruct\n============\n\nIntegration between structlog and graylog GELF, provided by graypy.\n\n\nRationale\n=========\n\nStructlog_ provides a rich tool for producing structured log messages\nfrom applications. Graypy_ provides a Python interface to emit logs in\nthe GELF_ format accepted by graylog_. In effect, structlog_\npre-processes the _inputs_ to Python ``logging`` module, while graypy_\nprocesses the outputs (``LogRecord`` instances), and neither expects the\nother to be present.\n\n``graystruct`` provides a small integration layer composed of two main\ncomponents that are used in conjunction with both structlog_ and\ngraypy_. These components minimally alter the behaviour of structlog_\nand graypy_ at their interface points so that they are able to cooperate\nin producing structured logs.\n\n\nExample\n=======\n\n\n.. code-block:: python\n\n >>> import logging\n >>> import structlog\n >>> from graystruct.encoder import GELFEncoder\n >>> from graystruct.handler import GELFHandler\n >>> from graystruct.utils import add_app_context\n >>> structlog.configure(\n ... logger_factory=structlog.stdlib.LoggerFactory(),\n ... processors=[\n ... # Prevent exception formatting if logging is not configured\n ... structlog.stdlib.filter_by_level,\n ... # Add file, line, function information of where log occurred\n ... add_app_context,\n ... # Format positional args to log as in stdlib\n ... structlog.stdlib.PositionalArgumentsFormatter(),\n ... # Add a timestamp to log message\n ... structlog.processors.TimeStamper(fmt='iso', utc=True),\n ... # Dump stack if ``stack_info=True`` passed to log\n ... structlog.processors.StackInfoRenderer(),\n ... # Format exception info is ``exc_info`` passed to log\n ... structlog.processors.format_exc_info,\n ... # Encode the message in GELF format (this must be the final processor)\n ... structlog.processors.GELFEncoder(),\n ... ],\n ... )\n >>> std_logger = logging.getLogger()\n >>> std_logger.setLevel(logging.WARNING)\n >>> gelf_handler = GELFHandler('localhost', 12201)\n >>> std_logger.addHandler(gelf_handler)\n >>> logger = structlog.get_logger('some.package')\n # Will transmit a GELF-encoded message\n >>> logger.error('user.login', username='sjagoe')\n\n\n.. _structlog: https://pypi.python.org/pypi/structlog\n.. _Structlog: https://pypi.python.org/pypi/structlog\n\n.. _graypy: https://pypi.python.org/pypi/graypy\n.. _Graypy: https://pypi.python.org/pypi/graypy\n\n.. _graylog: https://www.graylog.org\n.. _GELF: https://www.graylog.org/resources/gelf-2/", "description_content_type": null, "docs_url": null, "download_url": null, "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/sjagoe/graystruct", "keywords": null, "license": "BSD", "maintainer": null, "maintainer_email": null, "name": "graystruct", "package_url": "https://pypi.org/project/graystruct/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/graystruct/", "project_urls": { "Homepage": "https://github.com/sjagoe/graystruct" }, "release_url": "https://pypi.org/project/graystruct/0.1.1/", "requires_dist": null, "requires_python": null, "summary": "Integration between structlog and graylog GELF, provided by graypy", "version": "0.1.1" }, "last_serial": 1444559, "releases": { "0.0.1": [], "0.1.1": [ { "comment_text": "", "digests": { "md5": "c335a54c90021514172267a4656ef510", "sha256": "d76181886b0451e633d11e3023ebb4712d3452f944b13163661b775834569059" }, "downloads": -1, "filename": "graystruct-0.1.1.zip", "has_sig": false, "md5_digest": "c335a54c90021514172267a4656ef510", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10212, "upload_time": "2015-03-01T12:49:55", "url": "https://files.pythonhosted.org/packages/0c/b2/6d519b74d1f2e671bdaff707d4425763c9536692544c496a05c0e15fb785/graystruct-0.1.1.zip" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "c335a54c90021514172267a4656ef510", "sha256": "d76181886b0451e633d11e3023ebb4712d3452f944b13163661b775834569059" }, "downloads": -1, "filename": "graystruct-0.1.1.zip", "has_sig": false, "md5_digest": "c335a54c90021514172267a4656ef510", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10212, "upload_time": "2015-03-01T12:49:55", "url": "https://files.pythonhosted.org/packages/0c/b2/6d519b74d1f2e671bdaff707d4425763c9536692544c496a05c0e15fb785/graystruct-0.1.1.zip" } ] }