mrkeyoor.comAsk

Delgan/logurutested 25 Nov 2026commit 58e8b73

loguru review

Use Loguru when you own the application's logging configuration and want a concise sink API.

  • README install 0.6 s
  • 356 KB on disk
1,790/1,790tests passed
  • 0 dependencies
  • Install 17 s
Dev Toolsevaluationupdated 02 Dec 2026
+9stars / 7d

Loguru is a Python logging library with a preconfigured standard-error logger. Its sink API configures destinations, contextual fields, JSON serialization, file rotation and exception diagnostics.

Verdict

Use Loguru when you own the application's logging configuration and want a concise sink API. Our 0.8.0 quickstart emitted the README's DEBUG message successfully; the separate source-checkout build failed. Skip it when adoption requires unchanged pytest capture and dependency routing without adapters. Configure production sinks with diagnose=False and include process queues and shutdown in the integration work.

Loguru infographic: configure Python logging for console and file output, plus our test result and who it suits
Tested 2 December 2026: the README snippet ran as written. Before that: 25 Nov: 1,790 of 1,790 tests passed; uv install took 0.6 s.

We ran it

Lab card: what happened when we ran loguru
Lab card from our sandbox run
Screenshot of loguru (loguru.readthedocs.io)
loguru.readthedocs.io
Install✓ · 17s103 packages · 211 MB
Build✗ · 1s
Tests✓ · 157s1790 passed · 0 failed · 46 skipped of 1790 (pytest)
Repo318 files~21,443 lines of source · 1.6 MB · 5 CI workflows · tests dir

Answers from our run

Does loguru build from source?

Dependencies installed in 17 seconds (103 packages), and the build failed. We cloned commit 58e8b73 into a clean Debian container with 3 CPUs and no project-specific setup.

Do loguru's tests pass?

Yes. The project's own test command finished in 157 seconds and reported 1790 passed, 0 failed, 46 skipped (pytest).

Who should not use loguru?

Package authors who want consumers to use Python's standard logging interface without adopting another library.

What are the alternatives to loguru?

Python standard logging, structlog, Rich. Use Loguru when you own the application's logging configuration and want a concise sink API.

Setup5/5In our 2026-12-02 run it installed as the README says in 0.6 s and the README’s “Ready to use out of the box without boi…” example ran unedited.Editor’s note: The package quickstart succeeded, while the separate source build failed without an error tail. These different installation scopes do not support a numerical setup judgment.
Docs5/5The README has an install section (“Installation”) and usage examples in code, and its example ran as written in our 2026-12-02 run.Editor’s note: The README documents sinks, file policies, context, diagnostics and forwarding. The executed example covers basic console output, and the documentation is not pinned to the installed release.
Community5/5Last push on 2026-11-29, 24,177 stars and maintainers answered or closed 10 of the 10 most-discussed issues we sampled.Editor’s note: Sampled issues contain maintainer explanations and reported workarounds. Aggregated Reddit accounts and this issue sample do not measure support capacity or adoption.
Maturity4/5Latest release 0.8.0 on 2026-11-11 (pre-1.0), repository created 2017-08-15 and its test suite passed in our sandbox (1,790 of 1,790 passed).Editor’s note: The source test command succeeded alongside an unexplained build failure. Historical queue and rotation discussions do not establish current production delivery or restart behavior.

How we score

Discussed on

  1. hnPython logging made (stupidly) simple4 points

Who it’s for

Python application owners who want console output with little initial configuration.
Teams that want file rotation and contextual JSON records through one sink API.
Developers prepared to maintain adapters for pytest, dependency logging and telemetry.

Who it’s NOT for

Package authors who want consumers to use Python's standard logging interface without adopting another library.
Teams requiring existing caplog assertions to work after changing logging imports without a capture or propagation fixture.
Services that will retain default variable diagnostics despite handling sensitive data.
Windows worker applications expecting enqueue=True alone to transfer parent logger configuration.

Setup reality

Our November 25, 2026 source run at 58e8b73 installed in 17 seconds, recording 103 dependencies and 211 MB on disk. The build failed with exit 1 in 1 second. The test command succeeded in 157 seconds: 1,790 passed, zero failed and 46 skipped. The recorded total field is also 1,790; the categories are reported separately.

The December 2 quickstart installed PyPI Loguru 0.8.0 in 0.6 seconds, recorded 356 KB and zero additional packages, then ran the README example successfully in 0.6 seconds. The source checkout and package installation are separate environments with different purposes.

The November sandbox configuration specified 3 CPUs, 8 GB RAM and image ghcr.io/astral-sh/uv:python3.12-bookworm. The December quickstart used a separate container configured with 2 CPUs and 4 GB RAM. Application setup includes choosing sink levels, diagnostics, file policies and any adapters to standard logging.

Short answer: use it when you own the application's logging

Our Loguru 0.8.0 quickstart emitted the README's DEBUG message and exited successfully, while our separate source-checkout build failed. Use Loguru if you want a ready-made Python logger and can own its output configuration. Skip it if your requirement is unchanged pytest capture and dependency routing without adapters: issue #59 describes the capture problem, and the Loguru README shows explicit forwarding handlers.

Loguru's convenience comes from one imported logger and an API for configuring destinations. Applications can attach request context, render JSON and configure file rotation without building separate handler and formatter classes for each destination. The adoption decision still includes the existing logging routes: which dependencies use standard logging, which tests inspect captured messages and which workers share output. Those are concrete configuration jobs alongside the shorter application logging calls.

Loguru sends one message to several destinations

Loguru provides one preconfigured logger that writes to standard error, and add() registers additional destinations. The official overview lists sink types: files, streams, functions, coroutine functions and standard logging handlers. The logger dispatches messages to configured handlers, so application calls can remain the same while destinations use different formats, filters and severity thresholds. A console sink and a JSON file sink can serve different readers.

File rotation, retention and compression are separate settings. Rotation closes the current file and starts another, retention selects older files for removal, and compression converts closed files to an archive or compressed format. The README demonstrates fixed filenames with rotation, including file_1.log with a 500 MB threshold and file_2.log with daily rotation at 12:00. A timestamp placeholder is an available naming choice rather than a blanket requirement.

Loguru can retain fields alongside the message instead of putting every value into an English sentence. The README documents bind(), contextualize() and serialize=True: bind() attaches fields to extra, contextualize() temporarily changes context-local fields, and serialization converts a message and its record to JSON. A request identifier in context gives related events a shared field while allowing the message itself to describe the event.

What people use loguru for

Users quoted by trustmebro.reviews describe replacing configuration across three projects, removing environment-specific configuration code and adding terminal integrations. These accounts explain the convenience people value, while GitHub issue #59 describes pytest propagation work. The reports concern different projects and logging routes; their useful common question is what configuration the application owner replaces and what integration code the application retains.

Who used it What they did What they reported
Reddit user u/R****_, quoted by trustmebro.reviews Refactored three projects to use Loguru Reported keeping it because it worked without compilation and latency was not noticeable at their logging volume. Three-project account
Reddit user u/l****o, quoted by trustmebro.reviews Replaced logging configuration maintained for different environments Reported discarding their configuration code and making no further logging configuration changes. Configuration account
Reddit user u/r****r, quoted by trustmebro.reviews Used it with terminal integrations Called it adequate for their project and reported adding handlers for tqdm and Rich. Terminal-integration account
GitHub user dougthor42 Forwarded Loguru records into standard logging for pytest Reported a working propagation handler in conftest.py; Delgan recommended removing the added sink after each test. Pytest discussion

The same Reddit summary records disagreement about the value of reducing setup code. One commenter argued that AI could generate standard logging configuration; another still preferred Loguru's everyday interface after configuration was written. The quoted discussion distinguishes initial setup from subsequent use. For an application maintainer, both belong in the decision: configuration code is one cost, and the interface used throughout the application is another.

What happened when we ran it

Our December 2 run executed the README's three-line logging example unedited, exited 0 and produced its DEBUG message in 0.6 seconds. The example observation records that output. The run installed Loguru 0.8.0 from PyPI; its checkout identifier, b5efa30e7e26, records the example's provenance. The container was configured with 2 CPUs, 4 GB RAM, no published ports and no secrets, according to the quickstart run record.

Quickstart step Recorded outcome
Clone Recipe quickstart-lib completed in 1 second.
Package install uv pip install loguru installed 0.8.0 into a fresh virtual environment in 0.6 seconds.
Installed footprint 356 KB in the virtual environment's site-packages.
Additional packages Zero packages besides Loguru.
README example Exit 0, DEBUG output, 0.6 seconds.
Teardown Reported OK.

The first logging call printed "That's it, beautiful and simple logging!" with DEBUG severity. That result supports the immediate console-output benefit: the example imported logger and called debug() without first configuring a formatter or handler. The separate November source run used commit 58e8b73 and a sandbox configured with 3 CPUs, 8 GB RAM and image ghcr.io/astral-sh/uv:python3.12-bookworm. Its installation included the repository environment rather than only the installed Loguru package.

Source-checkout step Our recorded result
Install Succeeded in 17 seconds, with 103 dependencies recorded and 211 MB on disk.
Build Failed with exit 1 in 1 second.
Tests Command succeeded in 157 seconds: pytest recorded 1,790 passed, zero failed and 46 skipped, alongside a total field of 1,790.
Repository scan 318 files, approximately 21,443 source lines and 1.6 MB checked out; five CI workflow files, a tests directory and no Dockerfile detected.

We measured a successful installation, failed build and successful test command in the November source run. The test record lists 1,790 passed and 46 skipped while repeating 1,790 as its total, so the categories stay separate. The December package footprint was 356 KB; the November repository environment occupied 211 MB. These figures describe different installations, and the source environment's dependency count belongs to that environment.

Where people get stuck: sinks, capture and message formatting

Adding an INFO sink leaves the existing sink configured, which explains the unexpected DEBUG output discussed in issue #51. The add() method registers a destination; remove() can target the identifier returned when that destination was added. Retaining the console handler's identifier lets an application replace its console configuration while keeping a file sink. Removing all handlers has a broader effect.

Symptom What the discussion says to do Resolution described
DEBUG survives an INFO console sink Remove the old console handler before adding its replacement; retain handler IDs for selective removal. Delgan explained the coexisting handlers and linked the workaround in #51.
LOGURU_LEVEL in Dynaconf has no effect Populate the environment before initialization; later environment changes leave existing handlers unchanged. The reporter used Conda activation successfully; Delgan declined a public handler-mutation API in #138.
caplog assertions lose messages Add a capture or propagation sink in a fixture and remove that sink during teardown. dougthor42 reported propagation working; Delgan retained a documented workaround in #59.
Dictionary text raises KeyError Pass payloads through placeholders or attach context with bind(); avoid record=True for uncontrolled templates. Delgan explained the formatting trigger in #318.
Removing a bound logger's sinks changes other loggers Treat bind() as context attachment rather than independent handler configuration. Delgan suggested copying an initially handler-free base logger for independence in #487.

The brace-formatting problem concerns the difference between a template and data placed into it. In #318, fernhtls describes dictionary messages arriving through a FastAPI interception handler. Delgan explains that formatting can run when arguments or record=True are involved, causing literal braces to become template fields. The following complete illustration keeps the template under application control and passes the dictionary as data, following the formatting discussion:

from loguru import logger

logger.info("User data: {}", {"user": "someone"})
logger.bind(user="someone").info("User data: {}", {"user": "someone"})

The bind() call attaches context without passing it as a formatting keyword argument. That distinction is useful for interception handlers receiving messages from dependencies, where application code does not author every incoming string. For pytest migration, retain an assertion against the captured message itself. In issue #59, fixture cleanup removes the specific added sink, so teardown leaves unrelated output destinations configured.

Where it hurts at volume: queues still carry work

Compression runs in the logging thread unless queueing moves sink processing to another thread, according to Delgan's explanation in issue #243. The reporter, mahadi, described slow scheduling and network-request timeouts during compression, including after trying enqueue=True. A later subprocess experiment introduced another ordering problem: rotation could run before the compression process executed. Delgan proposed changing the ordering of that custom compression approach.

Windows process spawning introduced overlapping or missing output in issue #108. Delgan explained that child processes could create separate handlers and queues, preventing synchronization. The maintainer reported changing handler management and instructed users to pass the parent logger during child construction, using initializer and initargs where applicable. Disabling colors changed symptoms in the discussion, while the proposed configuration addressed logger ownership across processes.

Queued objects also have to deserialize successfully. In issue #329, Delgan traced a failure to telegram.error.NetworkError: pickle.dumps() succeeded, but pickle.loads() raised TypeError because the exception constructor required a message argument. The diagnostic "Record was: None" described failure to retrieve the record, rather than proving that a logging call had received None. The reporter subsequently described a similar error after moving from 0.5.0 to 0.5.3.

For thousands of task files, Delgan recommended limiting open files in issue #487, using a small set of handlers and bind() to identify workers. The official API also describes complete() as waiting for queued messages before returning an awaitable for coroutine-sink tasks. Process construction, open-file policy and completion therefore belong to different parts of the logging lifecycle, even when an application uses enqueue=True.

Security: disable variable diagnostics on production sinks

The official API says to set diagnose=False in production to avoid leaking sensitive data through exception-variable output. The diagnose parameter controls variable display in tracebacks, and its default is True. The README demonstrates values appearing beside stack frames. An application can therefore expose a local variable through exception diagnostics even when the message string does not explicitly include that variable.

Messages and extra fields are separate inputs to the log record. Choosing diagnose=False controls variable diagnostics; application code still chooses what it writes into those other fields. In issue #563, Delgan distinguished malicious Python objects from user strings and explicitly rejected arbitrary code execution from string input alone. The reporter disputed the use of pickle after a company dependency audit flagged it. The discussion concerns object trust and serialization as well as message text.

Loguru vs logging, structlog and Rich

Python standard logging integrates application and dependency messages through its shared interface; structlog processes structured events; Rich renders terminal content. The Python logging documentation describes application and library integration, while structlog describes functions operating on dictionaries. Choose around the interface and destination configuration your application needs to maintain. Loguru's ready-made logger is one architectural convenience among these different responsibilities.

Choice What you gain Pick it when
Loguru A preconfigured logger, sink registration, JSON serialization and file policies. Loguru README You own application configuration and want a concise route to console and file output.
Python standard logging An event logging system for applications and libraries. Python logging documentation Your code and dependencies should use the standard logging interface.
structlog Structured events with direct output or forwarding to an existing logging system. structlog README You want dictionary processing with control over the output backend.
Rich Terminal rendering, including tables, progress bars and tracebacks. Rich README Terminal presentation is the main requirement.

For "Loguru vs logger," loguru.logger is the imported entry point of this library; a standard logging logger belongs to Python's separate logging system. Rich can be complementary: a Reddit account quoted by trustmebro.reviews describes adding Rich handlers. For telemetry, Maple documents forwarding through standard logging. That route adds a bridge between the application API and the observability setup rather than removing integration code.

What the other reviews get wrong

Bare @logger.catch uses reraise=False by default, fixed filenames support rotation, and logging-call kwargs also populate extra. The official logger API defines these behaviors, including the distinction between file retention and compression. The corrections below identify the reviewed guide and the specific advice to replace. Exception propagation, file policy and dependency routing are separate configuration choices with different effects on application behavior.

Page Misleading claim Correction
Ryuslog's standard-logging comparison Bare @logger.catch re-raises the exception. The official catch() signature defaults to reraise=False; raising again requires an explicit choice.
FixDevs, Loguru Not Working Rotation always needs {time} in the filename. The official overview demonstrates fixed filenames with rotation.
FixDevs, Loguru Not Working Logging-call kwargs are only formatting arguments. The official API says kwargs also populate extra; JSON serialization is a separate choice.
DataCamp's tutorial Retention keeps a file count and compresses the rest. The API defines retention as removal and compression as conversion at closure, rather than compressed overflow storage.
Loguru.org's mastering guide Centralized framework logging needs no additional setup. The Loguru README shows explicit interception of standard logging.
Loguru.org's advanced logging guide Extensive logging has no negative application-performance impact. Issue #243 records compression-associated slowdowns and timeouts, alongside the maintainer's explanation of processing threads.
trustmebro.reviews' Reddit summary Loguru categorically lacks OpenTelemetry compatibility. Maple documents a standard-logging bridge, which is an explicit integration route.

The repository links its official documentation on Read the Docs, including the API reference, migration resources and changelog. That connection identifies the project's documentation more reliably than a product name appearing in an independent site's domain. For the decorator correction, the API's reraise=False signature supplies the direct behavioral definition; for retention and compression, the parameter descriptions explain which files are removed and when closed files are converted.

FAQ

Loguru starts with a preconfigured standard-error logger, so the first logging call needs no added sink. The official overview gives the import and DEBUG example. The questions below cover installation, destinations, levels and alternatives, including the recurring issue reports about DEBUG output and environment-loading order. A sink's threshold and the set of currently registered sinks are separate parts of configuration.

What is Loguru, and how do I start using it in Python?

Loguru is a Python logging library whose imported logger already writes to standard error. The README's first example imports logger and calls debug(). Add destinations at application startup when you need files, custom formatting or another sink. The imported logger dispatches messages to those configured handlers, which is why application modules can share the same entry point.

How do I install Loguru from PyPI with pip?

The documented installation command is pip install loguru. The official overview gives that package name, and our December quickstart used uv pip install loguru to install 0.8.0 into a fresh virtual environment. The package is named loguru; logger is the object imported from it. The installation and example outcomes appear separately in the run table above.

Where can I find Loguru's GitHub project?

The Python library's repository is Delgan/loguru on GitHub. Its README links the official documentation and project resources, including the API reference, help resources and changelog. The repository identity distinguishes this library from similarly named tools and independent tutorial sites. Its examples cover both initial console output and additional configuration for sinks, context and standard logging integration.

Should I choose Loguru or Python's standard logging module?

Choose standard logging when a shared application-and-dependency interface is your priority, and Loguru when its application API fits the configuration you own. The Python documentation explains integrated module logging. Loguru also documents library use, instructing authors to disable their namespace and avoid adding sinks inside the library. That option still asks consumers to participate in Loguru's interface.

How does Loguru compare with structlog, including performance?

Loguru emphasizes an imported logger and sink configuration; structlog describes structured events processed through functions operating on dictionaries. The structlog README documents direct output or forwarding. For performance decisions, Ryuslog advises using the intended format and sink. Output destination, formatting and enabled levels belong in that workload definition alongside the choice of logging interface.

How does Loguru compare with Rich?

Rich focuses on terminal rendering, while Loguru configures logging records and destinations. The Rich README lists tables, progress bars and tracebacks, as well as a handler for Python logging. A user account quoted by trustmebro.reviews describes combining Rich with Loguru. Terminal presentation and the application's logging interface can therefore be separate choices.

How do Loguru's logger and log levels work?

Each sink has a minimum severity threshold, and the logger dispatches messages to configured handlers. The official API lists TRACE, DEBUG, INFO, SUCCESS, WARNING, ERROR and CRITICAL. Different sinks can accept different thresholds for the same application. Adding another destination changes the handler set; it does not replace a previously configured destination or edit that destination's threshold.

How do I set or change Loguru's log level?

Set level when adding a sink, such as level="INFO". For an existing destination, Delgan describes removing and re-adding its handler or using a dynamic filter. Keep the identifier returned by add() when only one destination should change. That lets an application replace console output while retaining file destinations with their own levels and formats.

Why do DEBUG messages still appear after I add an INFO sink?

The original sink remains configured when you add another sink. In issue #51, the reporter still received DEBUG messages after adding an INFO destination, and Delgan explained the coexisting handlers. Replacing the existing console handler changes that configuration; merely adding another console handler creates an additional route for messages and can produce duplicate output.

Can I change a console sink's level without removing my file sinks?

Yes: remove the console handler using its identifier, then add its replacement. The official API defines remove(handler_id), and issue #51 discusses selective replacement alongside other sinks. Calling remove() without an identifier removes all handlers. Retaining the identifier at configuration time therefore preserves the ability to change one destination without rebuilding every other destination.

Why does LOGURU_LEVEL in my .env file fail to suppress DEBUG messages?

Environment-loading order explains the Dynaconf case in issue #138. Delgan states that changing environment values leaves existing handlers unchanged; the reporter used Conda activation successfully. A .env value and a handler's current threshold are different state. Populate the environment before initialization, or explicitly replace the relevant handler when configuration changes after the application has started.

How do I configure Loguru once so the level applies across Python files?

Configure the shared logger at application startup and import it in modules that emit messages. The README describes one logger dispatching to configured handlers. Adding replacement handlers in every module instead creates additional destinations. Process spawning introduces another initialization path, which is why the Windows discussion separately addresses transferring the parent logger during construction of child processes.

How do I log a Loguru exception?

Call logger.exception() inside an exception handler, or wrap a function with logger.catch. The README demonstrates both exception logging and the catch decorator. The official API defaults catch() to reraise=False, so choose propagation explicitly when the caller must receive the exception. Production sink configuration should also set diagnose=False to control exception-variable display.

What we have not tested yet

Our executed application task was the README quickstart; the revised dictionary example is a source-derived illustration and was not executed. The runs cover neither a production migration nor pytest fixture cleanup, Windows spawn, concurrent rotation across restarts, final queue delivery, coroutine completion or OpenTelemetry export. We also have no matched application benchmark comparing Loguru, standard logging, structlog and Rich, so these results support no numerical performance winner.

The November build record contains exit 1 without an error tail, leaving its cause unknown. Actual interpreter and operating-system versions require raw toolchain logs; container image labels record configuration. The test-summary denominator is inconsistent, and the November audit field is null. The repository README and stable/latest documentation are not pinned implementation extracts for 0.8.0, so their broader examples do not prove every documented detail's inclusion in that exact release.

Historical issue endpoints also differ. Issue #243 leaves slowdown after queueing and a proposed compression-order change unresolved; #329 promises improved handling without demonstrating delivery; #563 records a serialization dispute without demonstrated remediation. In issue #916, the reporter's daily-rotation and restart problem persisted after a suggested change from 0.7.0 to 0.6.0. The general formatting-bypass request in #318 and public logger.new() proposal in #487 remain open in the research record. Issue labels alone do not establish current distribution behavior.

The Reddit experiences come through trustmebro.reviews rather than independently retrieved original threads. The YouTube records contain no usable transcripts, and the Bilibili search lists videos without execution results. Those records support no claim that a creator completed an integration. Repository activity, successful test commands and favorable comments also leave production adoption and future support capacity unmeasured. For an established service, the useful next step is following an actual logging assertion through its intended destination and shutdown path.

Alternatives

ProjectWhat it isPick it when
Python standard logging gh↗Python's built-in event logging system for applications and libraries.Keep it when application code and dependencies should participate through the standard logging interface.
structlogStructured event processing with direct output or forwarding to an existing logging system.Choose it when dictionary processing and an existing standard logging backend fit your service.
RichTerminal rendering for text, tables, progress output and tracebacks.Choose it when terminal presentation is the main requirement; it can also complement a logging setup.

Sources

  1. Loguru project and README
  2. Official Loguru overview
  3. Official logger API
  4. Python standard logging documentation
  5. structlog project
  6. Rich project
  7. pytest capture discussion, issue 59
  8. Loguru-to-OpenTelemetry integration guide

More dev tools reviews