Add logging to a Python script with one import instead of configuring handlers and formatters.
Automatically rotate and compress log files by size or time without writing custom code.
Catch and log exceptions from background threads that would normally be silently ignored.
Output structured logs in JSON format for easier parsing by monitoring and analytics tools.
Loguru is a Python library that makes adding logs to your code as simple as a single import. Logging is the practice of recording what your program is doing as it runs, which functions ran, what errors occurred, what data was processed, so you can understand and debug it later. Python has a built-in logging system, but it requires significant setup (configuring handlers, formatters, and filters separately) which many developers skip in favor of just using print statements. Loguru replaces all that setup with one pre-configured logger object you can start using immediately. You call logger.info(), logger.warning(), logger.error(), and so on, and messages appear in your terminal with colors and timestamps by default. When you need more, a single add() function handles everything: writing to files, setting log levels, filtering by module, rotating log files by size or time schedule, compressing old logs, and more. Other conveniences include automatically catching and logging exceptions (even from background threads, which vanilla Python often silently swallows), structured logging for machine-readable output, and compatibility with Python's standard logging system so it can be dropped into existing projects. You would use Loguru any time you are writing a Python script or application and want proper logging without the usual configuration ceremony.
Generated 2026-05-18 · Model: sonnet-4-6 · Verify against the repo before relying on details.