structlog-pretty
================
.. image:: https://circleci.com/gh/underyx/structlog-pretty.svg?style=shield
:target: https://circleci.com/gh/underyx/structlog-pretty
:alt: CI Status
.. image:: https://codecov.io/gh/underyx/structlog-pretty/branch/master/graph/badge.svg
:target: https://codecov.io/gh/underyx/structlog-pretty
:alt: Code Coverage
A collection of structlog_ processors for prettier output: a code syntax
highlighter, JSON and XML prettifiers, a multiline string printer, and
a numeric value rounder.
Installation
------------
First of all, sorry, grandma, but ``structlog-pretty`` requires Python 3.
You can just install the library with pip::
pip install structlog-pretty
or, if you want faster prettifying processors::
pip install structlog-pretty[fast]
The downside of the faster processors is that they will build C extensions and
they need ``libxml`` to be installed.
Usage
-----
Add structlog-pretty processors to your structlog configuration
.. code-block:: python
import structlog
import structlog_pretty
structlog.configure(
# ...
processors=[
structlog.stdlib.add_log_level,
structlog_pretty.NumericRounder(digits=2, only_fields=['timing'])
structlog.processors.JSONRenderer(),
],
)
A nice example of a processor pipeline for the *prettiest* logs could be
.. code-block:: python
processors=[
# ...
structlog_pretty.JSONPrettifier(['request', 'response']),
structlog_pretty.XMLPrettifier(['soap_response']),
structlog_pretty.PathPrettifier(),
structlog_pretty.SyntaxHighlighter({'request': 'json', 'response': 'json', 'soap_response': 'xml'}),
structlog_pretty.MultilinePrinter(['request', 'response', 'soap_response']),
# ...
],
.. _structlog: https://github.com/hynek/structlog
Raw data
{
"_id": null,
"home_page": "https://github.com/underyx/structlog-pretty",
"name": "structlog-pretty",
"maintainer": "Bence Nagy",
"docs_url": null,
"requires_python": null,
"maintainer_email": "bence@underyx.me",
"keywords": null,
"author": "Bence Nagy",
"author_email": "bence@underyx.me",
"download_url": "https://files.pythonhosted.org/packages/9e/4c/faf8822fa7af8cfe3f7d93bba98db57e1e63be3c87378e7599668436602b/structlog_pretty-0.4.3.tar.gz",
"platform": null,
"description": "structlog-pretty\n================\n\n.. image:: https://circleci.com/gh/underyx/structlog-pretty.svg?style=shield\n :target: https://circleci.com/gh/underyx/structlog-pretty\n :alt: CI Status\n\n.. image:: https://codecov.io/gh/underyx/structlog-pretty/branch/master/graph/badge.svg\n :target: https://codecov.io/gh/underyx/structlog-pretty\n :alt: Code Coverage\n\nA collection of structlog_ processors for prettier output: a code syntax\nhighlighter, JSON and XML prettifiers, a multiline string printer, and\na numeric value rounder.\n\nInstallation\n------------\n\nFirst of all, sorry, grandma, but ``structlog-pretty`` requires Python 3.\n\nYou can just install the library with pip::\n\n pip install structlog-pretty\n\nor, if you want faster prettifying processors::\n\n pip install structlog-pretty[fast]\n\nThe downside of the faster processors is that they will build C extensions and\nthey need ``libxml`` to be installed.\n\nUsage\n-----\n\nAdd structlog-pretty processors to your structlog configuration\n\n.. code-block:: python\n\n import structlog\n import structlog_pretty\n\n structlog.configure(\n # ...\n processors=[\n structlog.stdlib.add_log_level,\n structlog_pretty.NumericRounder(digits=2, only_fields=['timing'])\n structlog.processors.JSONRenderer(),\n ],\n )\n\nA nice example of a processor pipeline for the *prettiest* logs could be\n\n.. code-block:: python\n\n processors=[\n # ...\n structlog_pretty.JSONPrettifier(['request', 'response']),\n structlog_pretty.XMLPrettifier(['soap_response']),\n structlog_pretty.PathPrettifier(),\n structlog_pretty.SyntaxHighlighter({'request': 'json', 'response': 'json', 'soap_response': 'xml'}),\n structlog_pretty.MultilinePrinter(['request', 'response', 'soap_response']),\n # ...\n ],\n\n.. _structlog: https://github.com/hynek/structlog\n",
"bugtrack_url": null,
"license": null,
"summary": "A collection of structlog processors for prettier output",
"version": "0.4.3",
"project_urls": {
"Download": "https://github.com/underyx/structlog-pretty/releases",
"Homepage": "https://github.com/underyx/structlog-pretty"
},
"split_keywords": [],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "2a57d6c3d2b337d3cc35359d072ce821d3991fee0d256ad2b1bd4b9e386cc099",
"md5": "3354d4d5ac4cb85d32a5d9b207be07f7",
"sha256": "352a2e0a1c59b95ef37da9da6caa7e3b25c34a8d7793fcc910c277eb7584d2bb"
},
"downloads": -1,
"filename": "structlog_pretty-0.4.3-py3-none-any.whl",
"has_sig": false,
"md5_digest": "3354d4d5ac4cb85d32a5d9b207be07f7",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 5715,
"upload_time": "2024-07-15T19:37:50",
"upload_time_iso_8601": "2024-07-15T19:37:50.905501Z",
"url": "https://files.pythonhosted.org/packages/2a/57/d6c3d2b337d3cc35359d072ce821d3991fee0d256ad2b1bd4b9e386cc099/structlog_pretty-0.4.3-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "9e4cfaf8822fa7af8cfe3f7d93bba98db57e1e63be3c87378e7599668436602b",
"md5": "05b90f1db3b4ad7614a2840ac1c807bd",
"sha256": "e5c6a8e98cdacd517a469dbedfe70de33eff5f2537343933024d6e2c0da8711d"
},
"downloads": -1,
"filename": "structlog_pretty-0.4.3.tar.gz",
"has_sig": false,
"md5_digest": "05b90f1db3b4ad7614a2840ac1c807bd",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 7406,
"upload_time": "2024-07-15T19:37:49",
"upload_time_iso_8601": "2024-07-15T19:37:49.685169Z",
"url": "https://files.pythonhosted.org/packages/9e/4c/faf8822fa7af8cfe3f7d93bba98db57e1e63be3c87378e7599668436602b/structlog_pretty-0.4.3.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-07-15 19:37:49",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "underyx",
"github_project": "structlog-pretty",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"circle": true,
"requirements": [
{
"name": "pygments",
"specs": [
[
"==",
"2.*"
]
]
}
],
"tox": true,
"lcname": "structlog-pretty"
}