The Julia docs are pretty clear on how to enable debugging messages from @debug macros, i.e. run export JULIA_DEBUG=mymodule or export JULIA_DEBUG=all on the command line before starting Julia. However, is there an easy way to enable debugging from within the Juno, or, more generally, while Julia is running?
I tried fiddling with Base.CoreLogging.disable_logging , Base.CoreLogging.BelowMinLevel and Base.CoreLogging._min_enabled_level without success.
I know I can set env variables for Julia in the Juno settings. But that's kind of annoying to work with as it requires restarting Julia. I really want to have the following workflow while working interactively:
Which I think is nicer than the common practice of commenting and un-commenting printf everywhere.
Enable @debug everywhere (this will only affect code loaded after running the following expression):
julia>ENV["JULIA_DEBUG"] = "all"
Enable @debug in file foo.jl (according to docs, haven't tested this):
julia>ENV["JULIA_DEBUG"] = "foo"
Disable @debug:
ENV["JULIA_DEBUG"] = ""
important note: macros are evaluated when code is loaded. So the tricks above will only have effect on code that is loaded after changing the value of JULIA_DEBUG. So after setting it to e.g. all, nothing will have changed. Reload the modules you want to @debug.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With