Skip to content

Commit 8a9d376

Browse files
committed
Undelete some not-actually-dead code
1 parent 0729900 commit 8a9d376

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

src/logging.jl

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,3 +57,13 @@ function with_progresslogger(f, _module, logger)
5757

5858
return Logging.with_logger(f, LoggingExtras.TeeLogger(logger1, logger2))
5959
end
60+
61+
function progresslogger()
62+
# detect if code is running under IJulia since TerminalLogger does not work with IJulia
63+
# https://github.com/JuliaLang/IJulia.jl#detecting-that-code-is-running-under-ijulia
64+
if (isdefined(Main, :IJulia) && Main.IJulia.inited)
65+
return ConsoleProgressMonitor.ProgressLogger()
66+
else
67+
return TerminalLoggers.TerminalLogger()
68+
end
69+
end

src/sample.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@ function mcmcsample(
304304
sampler::AbstractSampler,
305305
isdone;
306306
chain_type::Type=Any,
307-
progress=PROGRESS[],
307+
progress::Bool=PROGRESS[],
308308
progressname="Convergence sampling",
309309
callback=nothing,
310310
num_warmup=0,
@@ -328,7 +328,7 @@ function mcmcsample(
328328
start = time()
329329
local state
330330

331-
@ifwithprogresslogger (progress == true) name = progressname begin
331+
@ifwithprogresslogger progress name = progressname begin
332332
# Obtain the initial sample and state.
333333
sample, state = if num_warmup > 0
334334
if initial_state === nothing

0 commit comments

Comments
 (0)