Including code vs. typing into console produces different behavior. Why?
The file debug.jl contains the following code.
using Base.CoreLogging: Debug, global_logger
using Logging: ConsoleLogger
global_logger(ConsoleLogger(stderr, Debug))
a = 1
@debug "debug test" a
@info "info test" a
@warn "warn test" a
@error "error test" a
In the console.
Press Enter to start Julia.
Starting Julia...
_
_ _ _(_)_ | Documentation: https://docs.julialang.org
(_) | (_) (_) |
_ _ _| |_ __ _ | Type "?" for help, "]?" for Pkg help.
| | | | | | |/ _` | |
| | |_| | | | (_| | | Version 1.0.1 (2018-09-29)
_/ |\__'_|_|_|\__'_| | Official https://julialang.org/ release
|__/ |
julia> include("debug.jl")
┌ Info: info test
└ a = 1
┌ Warning: warn test
│ a = 1
└ @ Main C:\Users\Chris\Desktop\debug\debug.jl:7
┌ Error: error test
│ a = 1
└ @ Main C:\Users\Chris\Desktop\debug\debug.jl:8
julia> using Base.CoreLogging: Debug, global_logger
julia> using Logging: ConsoleLogger
julia> global_logger(ConsoleLogger(stderr, Debug))
ConsoleLogger(Base.TTY(Base.Libc.WindowsRawSocket(0x00000000000002b0) open, 0 bytes waiting), Debug, Logging.default_metafmt, true, 0, Dict{Any,Int64}())
julia> a = 1
1
julia> @debug "debug test" a
┌ Debug: debug test
│ a = 1
└ @ Main none:1
julia>
Why doesn’t the debug information display when the file is included?