{"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,"last_verified":"2026-05-09T00:00:00.000Z","next_check":"2026-08-07T00:00:00.000Z","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,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}