Skip to content

Commit

Permalink
enable progress logs from modules outside the notebook, fixes #1862
Browse files Browse the repository at this point in the history
  • Loading branch information
Pangoraw committed Jan 28, 2022
1 parent 989231c commit c4a0f53
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
5 changes: 3 additions & 2 deletions frontend/components/Logs.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@ import { SimpleOutputBody } from "./TreeView.js"
// Defined in editor.css
const GRID_WIDTH = 10
const RESIZE_THROTTLE = 60
const PROGRESS_LOG_LEVEL = "LogLevel(-1)"

const is_progress_log = (log) => {
return log.kwargs.find((kwarg) => kwarg[0] === "progress") !== undefined
return log.level == PROGRESS_LOG_LEVEL && log.kwargs.find((kwarg) => kwarg[0] === "progress") !== undefined
}

export const Logs = ({ logs, line_heights, set_cm_highlighted_line }) => {
Expand Down Expand Up @@ -99,7 +100,7 @@ const Dot = ({ set_cm_highlighted_line, show, msg, kwargs, x, y, level }) => {
// }, [body])
const [inspecting, set_inspecting] = useState(false)

const is_progress = is_progress_log({ kwargs })
const is_progress = is_progress_log({ level, kwargs })
let progress = null
if (is_progress) {
progress = kwargs.find((p) => p[0] === "progress")[1][0]
Expand Down
6 changes: 5 additions & 1 deletion src/runner/PlutoRunner.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1983,7 +1983,11 @@ function Logging.shouldlog(::PlutoLogger, level, _module, _...)
# Accept logs
# - From the user's workspace module
# - Info level and above for other modules
(_module isa Module && is_pluto_workspace(_module)) || convert(Logging.LogLevel, level) >= Logging.Info
# - LogLevel(-1) because that's what ProgressLogging.jl uses for its messages
level = convert(Logging.LogLevel, level)
(_module isa Module && is_pluto_workspace(_module)) ||
level >= Logging.Info ||
level == Logging.LogLevel(-1)
end

Logging.min_enabled_level(::PlutoLogger) = Logging.Debug
Expand Down

0 comments on commit c4a0f53

Please sign in to comment.