-
Notifications
You must be signed in to change notification settings - Fork 751
Open
Labels
enhancementImprovement to an already existing featureImprovement to an already existing featurequestionFurther information is requestedFurther information is requested
Description
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
Labels
enhancementImprovement to an already existing featureImprovement to an already existing featurequestionFurther information is requestedFurther information is requested