{"id":28307,"library":"structlog-pretty","title":"structlog-pretty","description":"A collection of structlog processors to produce prettier log output, including syntax highlighting, numeric rounding, and key-value formatting. Current version 0.4.3, maintained but low release cadence.","status":"active","version":"0.4.3","language":"python","source_language":"en","source_url":"https://github.com/underyx/structlog-pretty","tags":["structlog","logging","pretty","processors"],"install":[{"cmd":"pip install structlog-pretty","lang":"bash","label":"default"}],"dependencies":[{"reason":"Required to use structlog processors.","package":"structlog","optional":false},{"reason":"Optional dependency for SyntaxHighlighter processor.","package":"pygments","optional":true}],"imports":[{"note":"Top-level import fails; processors are in submodule.","wrong":"from structlog_pretty import NumericRounder","symbol":"NumericRounder","correct":"from structlog_pretty.processors import NumericRounder"},{"note":"Importing from top-level returns AttributeError.","wrong":"from structlog_pretty import SyntaxHighlighter","symbol":"SyntaxHighlighter","correct":"from structlog_pretty.processors import SyntaxHighlighter"},{"note":"","wrong":"","symbol":"KeyValueFormatter","correct":"from structlog_pretty.processors import KeyValueFormatter"}],"quickstart":{"code":"import structlog\nfrom structlog_pretty.processors import NumericRounder, KeyValueFormatter\n\nstructlog.configure(\n    processors=[\n        structlog.stdlib.add_log_level,\n        structlog.processors.TimeStamper(fmt=\"iso\"),\n        NumericRounder(),\n        KeyValueFormatter(),\n        structlog.dev.ConsoleRenderer()\n    ],\n    context_class=dict,\n    wrapper_class=structlog.stdlib.BoundLogger,\n    cache_logger_on_first_use=True,\n)\nlog = structlog.get_logger()\nlog.info(\"Logging with style\", count=1234.5678, user=\"alice\")","lang":"python","description":"Basic configuration with NumericRounder and KeyValueFormatter."},"warnings":[{"fix":"Upgrade: pip install structlog-pretty>=0.1.1","message":"NumericRounder may convert boolean values to floats (0.0/1.0) unless you upgrade to v0.1.1 or later. Always use >=0.1.1.","severity":"breaking","affected_versions":"<0.1.1"},{"fix":"Install Pygments: pip install pygments","message":"SyntaxHighlighter requires Pygments to be installed; otherwise it silently falls back to plain text. No error is raised.","severity":"gotcha","affected_versions":"all"},{"fix":"Strip trailing whitespace manually if needed.","message":"Trailing whitespace in log messages is preserved, which can cause unexpected line breaks if not intended.","severity":"gotcha","affected_versions":">=0.4.3"}],"env_vars":null,"search_vec":"'0.4.3':26 'cadenc':31 'collect':5 'current':24 'format':23 'highlight':16 'includ':14 'key':21 'key-valu':20 'log':12,33 'low':29 'maintain':27 'numer':17 'output':13 'pretti':3,34 'prettier':11 'processor':8,35 'produc':10 'releas':30 'round':18 'structlog':2,7,32 'structlog-pretti':1 'syntax':15 'valu':22 'version':25","created_at":"2026-05-09T05:54:49.139118+00:00","updated_at":"2026-05-09T05:54:49.139118+00:00","problems":[{"fix":"Use: from structlog_pretty.processors import NumericRounder","cause":"Importing from wrong module – should be structlog_pretty.processors.","error":"AttributeError: module 'structlog_pretty' has no attribute 'NumericRounder'"},{"fix":"Ensure value is not NaN or upgrade to latest version.","cause":"NumericRounder encountered NaN value; older versions had this bug if decimal places set incorrectly.","error":"ValueError: cannot convert float NaN to integer"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":"","cli_version":null,"type":"library","homepage":null,"github":"https://github.com/underyx/structlog-pretty","docs":null,"changelog":null,"pypi":"https://pypi.org/project/structlog-pretty/","npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":["observability"],"base_url":null,"auth_type":null,"provenance":{"verified_status":"passing","verified_at":"2026-06-29","last_verified":"2026-06-29","next_check":"2026-07-29","install_tag":null}}