Skip to content

Conversation

@PetrHeinz
Copy link
Member

Some logs may have been left unsent on process termination. Wait with exiting the process until pipe is empty.


Tested with this block in example-project script right below logger initialization:

import threading
import time

def some_thread_function():
    print("Starting thread")
    time.sleep(1)
    for i in range(10):
        logger.debug("I am using Logtail in a thread! " + str(i))
    print("Ending thread")

t = threading.Thread(target=some_thread_function, daemon=True)
t.start()

Before suggested changes, I am using Logtail in a thread! 0 was the last message send (instead of I am using Logtail in a thread! 9)

@PetrHeinz PetrHeinz requested a review from gyfis October 12, 2023 16:10
Copy link
Contributor

@gyfis gyfis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@PetrHeinz PetrHeinz merged commit 24034a0 into master Oct 12, 2023
@PetrHeinz PetrHeinz deleted the ph/flushing-at-shutdown branch October 12, 2023 16:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants