-
-
Notifications
You must be signed in to change notification settings - Fork 286
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Logging in notebook #437
Logging in notebook #437
Conversation
This comment has been minimized.
This comment has been minimized.
src/runner/PlutoRunner.jl
Outdated
|
||
# we put this in __init__ to fix a world age problem | ||
function __init__() | ||
Logging.global_logger(PlutoLogger()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It may be better just to use Logging.with_logger()
in some context which surrounds the user's code?
This is super cool! Let me know if there's any help you'd like in integrating this, or subtle questions about the logging system. I'm also happy to do a call if that's helpful? (Note I am in AEST=UTC+10) I can help out with the Julia side of the code if necessary. Figuring out the most correct way to format the log messages might be the hard bit. |
Right now the messages only appear if you had the notebook open while the logs happened, so the logs are lost when you refresh. Instead, logs need to be stored in an array inside the cell's state. Our current state management is not very flexible - implementing this means adding a couple of new message types, handlers and state updates, and some careful thinking to ensure that the state is never corrupt. We were planning to update the state management system soon, so I think it would be nicer to wait for that. |
Sure, no problem at all. What are your thoughts for UI when log records arise from code defined outside Pluto, or from functions defined in other cells? I can think of a couple of options:
I kinda favor trying the dynamic option and seeing how it pans out. |
The idea would be to add a call to For async tasks, note that loggers are inherited from the parent task if |
Quick thought on the UI: I would prefer the dots from the same iteration of the loop to be vertically aligned. That way there is a little bit more information, directly visible. I guess this idea breaks the case where multiple logging events happen on a single line of a single iteration of the loop, but this could be solved by having two or three sectors with different colors as needed. Exactly how many logging events are happening at a single point in the code is rarely as useful as quickly realizing whether several events happening in a loop are happening on the same or on different iterations (in my experience, which is more limited than yours, so feel free to correct me if I'm wrong). If this idea can work well or not probably depends on how you show the details of each event, that view may become unwieldy in cases where many events get bundled into a single dot. If so then the usefulness may not be worth the drawback. |
@dralletje Can you take a look at the state diffing performance problem in this PR? You had a solution right? |
background: hsl(0deg 0% 100% / 81%); | ||
} | ||
|
||
/* @media screen and (max-width: calc(700px + 25px + 6px + 150px)) { */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this commented on purpose? @fonsp
Hard to believe looking at the diff, but there is no functional change (except some more @skip_as_script's for tests and examples)
This reverts commit cc8a164.
@dralletje Your recent commits (0e5f8ce and cc045d3) did the trick! Script: https://gist.github.com/fonsp/9551c8688f05b4baf21d3f242696dfcc |
Schermopname.2021-04-02.om.19.16.30.mov
Adds support for Julia logging:
@info
,@warn
,@debug
,@error
and custom log messages.(This does not relay the terminal - that is a different subject.)
TODO
The log should "pop out" of theoverflow:hidden
box when you click on it.Selecting cells is difficult if there are also logsuse a lighter background for the kwargsTest notebook
https://github.com/fonsp/disorganised-mess/blob/main/logging.jl
Try it out!