Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Compatibility with IPython / prompt toolkit #1385

Copy link
Copy link
@GDYendell

Description

@GDYendell
Issue body actions

Console output from loguru seems to bypass the buffering IPython does to keep its user prompt pinned to the bottom, so you get this:

In [1]: 2025-09-23 16:29:39.811 | INFO     | __main__:background_logger:13 - Log message 1
2025-09-23 16:29:40.812 | INFO     | __main__:background_logger:13 - Log message 2
2025-09-23 16:29:41.812 | INFO     | __main__:background_logger:13 - Log message 3
In [2]:

This does not happen with std logging structlog using the defaults, which uses print() to render to console. The behaviour is the same std logging.

Reproduce with:

import threading
import time

import IPython
from loguru import logger


def background_logger():
    count = 0
    while count < 3:
        time.sleep(1)
        count += 1
        logger.info(f"Log message {count}")


threading.Thread(target=background_logger, daemon=True).start()

IPython.embed()

Is there any way to make this work nicely?

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementImprovement to an already existing featureImprovement to an already existing featurequestionFurther information is requestedFurther information is requested

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.