Is there a way to set the logging level of a cell in Pluto? By default it will show everything, including debug
. Or even just a way to set it globally?
Pluto notebooks are a great way to debug newly developed code, and sometimes I have a need for debug prints when going over complex loops. Other times these same prints would flood the output, causing lag and taking out space.
I find myself using this pattern a lot
my_log_level >= -1000 && @debug "my message"
but it seems redundant to re-invent the wheel.
Alternatively, I can create my own logger and send it to stdout
, which will show up under the cell.
logger1 = ConsoleLogger(stdout, Logging.Info)
with_logger(logger1) do
foo()
current_logger()
end
However, this converts the logs to pure text, losing some of the advanced display functionality Pluto has. Also, the font color for part of the text is not suitable for the background.