When user code breaks their debug prints are frequently not visible in Cloud UI because the prints are buffered inside a hanging Python process memory buffer, i.e.:
@function()
def my_function() -> int:
print("Debug print")
# Or crash the process here instead.
while True:
pass
In this case the debug print is not visible in cloud UI logs because the printed string is in a Python process buffer and it's not written yet into stdout file descriptor so Log Saver can ingest the debug print and send it into our logging backends.
To fix this we need to remove all buffering in logs printed via:
- print()
- write(sys.stdout)
- write(sys.stderr).
When user code breaks their debug prints are frequently not visible in Cloud UI because the prints are buffered inside a hanging Python process memory buffer, i.e.:
In this case the debug print is not visible in cloud UI logs because the printed string is in a Python process buffer and it's not written yet into stdout file descriptor so Log Saver can ingest the debug print and send it into our logging backends.
To fix this we need to remove all buffering in logs printed via: