Pluto.jl icon indicating copy to clipboard operation
Pluto.jl copied to clipboard

Logging: Scope loggers to cell

Open Pangoraw opened this issue 1 year ago • 3 comments

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.

async_io

TODO:

This pr removes the global logger replacement, is it needed?

Pangoraw avatar Aug 19 '22 15:08 Pangoraw

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

github-actions[bot] avatar Aug 19 '22 15:08 github-actions[bot]

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.

disberd avatar Aug 25 '22 08:08 disberd

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 avatar Aug 31 '22 14:08 Pangoraw

@Pangoraw could you update the TODO list? Is the global logger issue the only thing left before merging?

fonsp avatar Oct 12 '22 11:10 fonsp

@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?

Pangoraw avatar Oct 13 '22 06:10 Pangoraw