livebook-dev / livebook

Automate code & data workflows with interactive Elixir notebooks
https://livebook.dev
Apache License 2.0
4.89k stars 419 forks source link

Unexpected Logger output location #1603

Closed zolrath closed 1 year ago

zolrath commented 1 year ago

Environment

Current behavior

When outputting a cell only containing multiple Logger messages they are separated in different Kino frames.

In this example, the first Logger output is listed in the top frame with the remaining Logger outputs in the second frame. If there is an expression above the Logger outputs, they all appear in the same frame.

https://user-images.githubusercontent.com/454563/209405622-044cdeac-2501-407f-a88a-fd9c84f0756b.mov

It didn't happen during recording, but I had an instance where the output changed if there was a new line between the 1 + 1 and the Logger statement, requiring a blank line between the two for the Logger output to move to the end frame.

Expected behavior

I would expect all Logger outputs to be grouped, regardless of their placement in the cell/other codes presence.

jonatanklosko commented 1 year ago

Hey @zolrath! Logger works asynchronously, so this is not exactly deterministic. You could do Logger.configure(sync_threshold: 0) to make sure every log is synchronous.

zolrath commented 1 year ago

Hey @zolrath! Logger works asynchronously, so this is not exactly deterministic. You could do Logger.configure(sync_threshold: 0) to make sure every log is synchronous.

Ahh, that makes sense. This was for a specific example Livebook, so that option works perfectly, thanks!