Skip to main content

MkDocs plugin to suppress unwanted log messages using pattern matching.

Project description

Suppress Logs Plugin for MkDocs

MkDocs and its plugins often produce many informational log messages that, while helpful, can clutter your terminal during site builds and make real issues harder to spot.

This plugin allows you to silence specific log messages using customizable wildcard patterns. It's especially useful for suppressing known, non-critical log lines such as:

INFO    -  Doc file 'some.md' contains an absolute link '/path', it was left as is.
INFO    -  Doc file 'other.md' contains an unrecognized relative link '../foo', it was left as is.

💡 Use Case

If you're using plugins like mkdocs-webcontext-plugin to rewrite links or your site intentionally contains absolute or unresolved relative links, this plugin can filter those benign warnings.

✅ Features

  • Pattern-based filtering of log messages.
  • Wildcard support using {*} for variable sections.
  • Supports multiple loggers (like mkdocs.structure.pages, etc.).
  • Keeps your terminal output clean and focused.

📦 Installation

Install from PyPI:

pip install mkdocs-suppress-logs-plugin

Or with Poetry:

poetry add mkdocs-suppress-logs-plugin

⚙️ Configuration

Add the plugin to your mkdocs.yml:

plugins:
  - suppress_logs:
      patterns:
        - "Doc file '{*}' contains an absolute link '{*}', it was left as is."
        - "Doc file '{*}' contains an unrecognized relative link '{*}', it was left as is. Did you mean '{*}'?"
      loggers:
        - mkdocs.structure.pages

🔧 Pattern Matching

Use {*} as a wildcard in messages you want to suppress.

Example log line:

INFO    -  Doc file 'guide.md' contains an absolute link '/img.png', it was left as is.

Matching pattern:

Doc file '{*}' contains an absolute link '{*}', it was left as is.

This will suppress any message with that general structure, regardless of the exact file or link.


🧪 Tips

  • To find the logger emitting a message, run MkDocs with --verbose.
  • You can add multiple patterns and logger names.
  • Regex is used under the hood, so avoid overly broad wildcards.

🙏 Thanks

This plugin was inspired by the need for clean terminal outputs during large MkDocs builds and complements:


🗪 License

MIT License – use freely, contribute generously.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mkdocs_suppress_logs_plugin-0.1.1.tar.gz (3.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mkdocs_suppress_logs_plugin-0.1.1-py3-none-any.whl (4.3 kB view details)

Uploaded Python 3

File details

Details for the file mkdocs_suppress_logs_plugin-0.1.1.tar.gz.

File metadata

File hashes

Hashes for mkdocs_suppress_logs_plugin-0.1.1.tar.gz
Algorithm Hash digest
SHA256 ff675b1d315eb28ae2b9a4f1ecb848e11b311ee02140f049270f0251276401a1
MD5 6c3b48dacf258c6f69d0f7e6af772738
BLAKE2b-256 d3ccefd285870e34c9dcb5c381d29698fda012371213a5b83bd23d8a783f6851

See more details on using hashes here.

File details

Details for the file mkdocs_suppress_logs_plugin-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for mkdocs_suppress_logs_plugin-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 5bb4c286006e6883f40b07cc45dd17043ba29653ada4c27240a60a3aa083f567
MD5 8c8811b7bcb67f20997f932e652293b8
BLAKE2b-256 599fea7e907b18a622334e6dbed2ba98ec91b616019f93f9cc4cc5d58797bfb5

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page