Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add/Remove are not thread-safe #22

Closed
joshuaellinger opened this issue Dec 24, 2018 · 3 comments
Closed

Add/Remove are not thread-safe #22

joshuaellinger opened this issue Dec 24, 2018 · 3 comments
Labels
bug Something isn't working

Comments

@joshuaellinger
Copy link

joshuaellinger commented Dec 24, 2018

import threading
from loguru import logger

def open_log_file(fn:str):

logger.add(fn)
logger.info("test message")

logger.info("write to 10 files")
for i in range(10):
fn = "test_" + str(i) + ".log"
logger.info(f"fn = {fn}")
t = threading.Thread(target=open_log_file, kwargs={"fn":fn})
t.start()

@Delgan
Copy link
Owner

Delgan commented Dec 24, 2018

Thanks for the bug report! I will submit a fix as soon as possible.

@Delgan
Copy link
Owner

Delgan commented Dec 26, 2018

I just pulished version 0.2.4 of Loguru with a fix for this.

Please, don't hesitate to open a new issue if you encounter another problem. 👍

@Delgan Delgan closed this as completed Dec 26, 2018
@Delgan
Copy link
Owner

Delgan commented Jan 6, 2019

NB: My "fix" (62d13ce) introduced another type of race condition that is properly fixed by 2bc0cda.

@Delgan Delgan added the bug Something isn't working label Mar 3, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants