{"id":21597,"library":"multiline-log-formatter","title":"Multiline Log Formatter","description":"A Python logging formatter that prefixes multiline log messages and tracebacks with the log level, ensuring uniform indentation for multi-line output. Current version 0.1.8. Low release cadence; last update 2022.","status":"active","version":"0.1.8","language":"python","source_language":"en","source_url":"https://github.com/peterlauri/python-multiline-log-formatter","tags":["logging","formatter","multiline","traceback"],"install":[{"cmd":"pip install multiline-log-formatter","lang":"bash","label":"Install from PyPI"}],"dependencies":[],"imports":[{"note":"Use underscores in package name for imports.","wrong":"from multiline-log-formatter import MultilineLogFormatter","symbol":"MultilineLogFormatter","correct":"from multiline_log_formatter import MultilineLogFormatter"}],"quickstart":{"code":"import logging\nfrom multiline_log_formatter import MultilineLogFormatter\n\nlogger = logging.getLogger(__name__)\nhandler = logging.StreamHandler()\nformatter = MultilineLogFormatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')\nhandler.setFormatter(formatter)\nlogger.addHandler(handler)\nlogger.setLevel(logging.DEBUG)\n\nlogger.info('Single line message')\ntry:\n    1/0\nexcept:\n    logger.exception('An error occurred')","lang":"python","description":"Basic usage with StreamHandler and exception logging."},"warnings":[{"fix":"Check if the output meets your expectations; consider using a custom formatter if you need each line prefixed.","message":"The formatter does not prefix continuation lines of a multiline message with the log level; it only indents them. The prefix appears only on the first line.","severity":"gotcha","affected_versions":"all"},{"fix":"Import using underscores.","message":"The package name in pip uses hyphens (multiline-log-formatter), but the Python import uses underscores (multiline_log_formatter).","severity":"gotcha","affected_versions":"all"},{"fix":"None.","message":"No known deprecations. The package has not been updated since 2022.","severity":"deprecated","affected_versions":"0.1.8"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Use: from multiline_log_formatter import MultilineLogFormatter","cause":"Trying to import the package with hyphens instead of underscores.","error":"ModuleNotFoundError: No module named 'multiline-log-formatter'"},{"fix":"Use: from multiline_log_formatter import MultilineLogFormatter (note capital letters)","cause":"Incorrect import spelling or case.","error":"AttributeError: module 'multiline_log_formatter' has no attribute 'MultilineLogFormatter'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}