--- id: pytest-loguru version: "0.4.1" license: MIT license_treatment: permissive maintenance: active --- # pytest-loguru — Pytest Loguru License: permissive · Maintenance: active · Downloads: 303.0K/mo ## What it is and what it does pytest-loguru is a pytest plugin that bridges loguru's structured logging with pytest's built-in caplog fixture. When you use loguru for logging in your application, pytest's standard caplog fixture does not capture those logs by default—this plugin solves that by making loguru logs available through caplog, so you can write assertions on them just as you would with the standard library's logging module. The plugin is lightweight, requiring only loguru as a runtime dependency, and works across Python 3.8 through 3.12 on all major operating systems. It's maintained actively and carries no known security vulnerabilities, making it a straightforward addition to test suites that already use loguru for application logging. Use it for: - Verify that your application logs specific messages at the correct log level during unit tests - Assert that error or warning logs are emitted when expected in exception-handling code paths - Capture and inspect structured log fields added by loguru in test assertions - Ensure log output does not contain sensitive information before it reaches production ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Extends pytest's caplog fixture to capture and assert on logs produced by loguru, enabling structured logging verification in pytest tests. Yes. If you use loguru in your application and pytest for testing, this plugin is a straightforward, low-friction addition that removes a gap in test observability. It has no known vulnerabilities, active maintenance, and a permissive license. Install it if you need to assert on loguru output in tests. ## Install pip install pytest-loguru uv add pytest-loguru poetry add pytest-loguru ## Installing pytest-loguru Before you install: Low friction: pure Python wheel with a single runtime dependency on loguru. Active maintenance with a recent release (90 days ago) and no known vulnerabilities. License in practice: MIT license permits unrestricted use, modification, and distribution in both open-source and proprietary projects. Quickstart: pip install pytest-loguru import pytest from loguru import logger def test_logging(caplog): logger.info("test message") assert "test message" in caplog.text Verify before relying: - Whether caplog integration works with all loguru sink types or only standard handlers - Performance impact when capturing high-volume loguru output in large test suites ## Package facts - License: MIT (permissive) - Python support: supports_current - Install friction: low - Maintenance: active - Downloads: 303.0K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags pytest loguru integration, caplog fixture loguru, loguru log capture pytest, structured logging pytest, loguru test assertions, pytest-plugin, logging, test-fixtures [View on SkillFed](https://skillfed.io/packages/pytest-loguru) · [View on PyPI](https://pypi.org/project/pytest-loguru/)