Pluto.jl
Pluto.jl copied to clipboard
Logging: Scope loggers to cell
Alternate implementation based on #2216. This allows to use the same logger in an asynchronous manner. The logs will be displayed under the right cell automatically because we can keep the writing task for longer. This fixes #2121.
TODO:
This pr removes the global logger replacement, is it needed?
Try this Pull Request!
Open Julia and type:
julia> import Pkg
julia> Pkg.activate(temp=true)
julia> Pkg.add(url="https://github.com/fonsp/Pluto.jl", rev="scope_logger_cell_io")
julia> using Pluto
Just checked this out to see if by chance it would also solve #2196 and I noticed that logs generated inside the macro body (so evaluated at compile time) are completely lost, they are not attached to any cell anymore and they do not appear in the julia session that started Pluto either.
Printing to stdout within the macro body is sent to the julia session where Pluto was started, so the complete loss of logs only happens for stuff like @info
.
Thanks for testing, the behavior is currently that logs are pushed to the right cell during expansion but the cell clears its logs when it's about to run. I need to add a mechanism to prevent clearing logs from macro-expansion but it should be easier than with what we had previously explored during the weekly call.
@Pangoraw could you update the TODO list? Is the global logger issue the only thing left before merging?
@Pangoraw could you update the TODO list?
The most problematic is point raised by @disberd where macro expansion logs are dropped when the cell is run, making them impossible to read.
Is the global logger issue the only thing left before merging?
From my understanding, we can safely remove the global logger since there should be only a few non-trivial way to escape local cell loggers anyway. What do you think?
I added log capture during expansion + replay when the cell is finally executed.
Awesome work Paul! I will take a look soon 🎉