Skip to content

Commit

Permalink
replace global logger in init()
Browse files Browse the repository at this point in the history
  • Loading branch information
fredrikekre committed Jul 6, 2018
1 parent d2402aa commit 5f7ef16
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
5 changes: 5 additions & 0 deletions src/init.jl
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,11 @@ function init(args)
end
redirect_stdin(IJuliaStdio(stdin,"stdin"))

if isdefined(Base, :CoreLogging)
logger = Base.CoreLogging.SimpleLogger(Base.stderr)
Base.CoreLogging.global_logger(logger)
end

send_status("starting")
global inited = true
end
9 changes: 0 additions & 9 deletions src/stdio.jl
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,6 @@ for s in ("stdout", "stderr", "stdin")
@eval function Base.$f(io::IJuliaStdio)
io[:jupyter_stream] != $s && throw(ArgumentError(string("expecting ", $s, " stream")))
if isdefined(Base, :stdout)
# On Julia 0.7, we need to override the global logger as well
logger = Base.CoreLogging._global_logstate.logger

# Override logging if it's pointing at the default stderr
if logger.stream == Base.stderr
new_logstate = Base.CoreLogging.LogState(typeof(logger)(io, logger.min_level))
Core.eval(Base.CoreLogging, Expr(:(=), :(_global_logstate), new_logstate))
end

Core.eval(Base, Expr(:(=), $sq, io))
else
# On Julia 0.6-, the variables are called Base.STDIO, not Base.stdio
Expand Down

0 comments on commit 5f7ef16

Please sign in to comment.