Skip to content
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

🧻 Julia Logging in browser console #496

Merged
merged 12 commits into from
Sep 26, 2020
Merged

🧻 Julia Logging in browser console #496

merged 12 commits into from
Sep 26, 2020

Conversation

fonsp
Copy link
Owner

@fonsp fonsp commented Sep 26, 2020

A basic version of #437. It relays all Logging messages to the browser console (and also to the original terminal).

That PR will take a lot of work to get right, and it would be nice to have something simple before it it finished.

@fonsp
Copy link
Owner Author

fonsp commented Sep 26, 2020

Log messages are visible in the browser console:

image

And as a quick hack they contain the line node so that you can hover to see where it came from:

image

@fonsp fonsp marked this pull request as ready for review September 26, 2020 14:26
@fonsp
Copy link
Owner Author

fonsp commented Sep 26, 2020

@c42f @shashi @dralletje

@fonsp fonsp changed the title Julia Logging in browser console 🧻 Julia Logging in browser console Sep 26, 2020
@fonsp fonsp merged commit bbda74b into master Sep 26, 2020
@fonsp fonsp deleted the logging-basic branch September 26, 2020 14:50
Copy link
Contributor

@c42f c42f left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very cool! I suggest the 📜 emoji for logging 😆

Mapping to the javascript console logger is a neat way to get UI functionality without a lot of up front work.

I suspect debug logging may be too verbose to use by default (as other packages may emit debug messages). I suggest we restrict debug messages to come from the user's notebook module only.

}

export const handle_log = ({ level, msg, file, line, kwargs }, filename) => {
const f = log_functions[level]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You may want a fallback here - it's possible for level to be things which are not equal to the standard levels (see, for example the @progress macro from ProgressLogging, which will cause errors on the javascript side.)

import ..Configuration: CompilerOptions
import ..PlutoRunner
import Distributed

"Contains the Julia process (in the sense of `Distributed.addprocs`) to evaluate code in. Each notebook gets at most one `Workspace` at any time, but it can also have no `Workspace` (it cannot `eval` code in this case)."
mutable struct Workspace
pid::Integer
log_channel::Distributed.RemoteChannel
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd potentially suggest that you make this an AbstractLogger instance, and wrap every invocation of a command within the workspace in a with_logger.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh wait, this is the recv side? Seems good in that case.

@fonsp fonsp added the logging About `@info`, `@warn`, etc label Mar 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
logging About `@info`, `@warn`, etc
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants