Skip to content

Instantly share code, notes, and snippets.

@Datseris
Created September 30, 2018 15:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Datseris/e222540d8acb94d86cdd7ecc9b487fb5 to your computer and use it in GitHub Desktop.
Save Datseris/e222540d8acb94d86cdd7ecc9b487fb5 to your computer and use it in GitHub Desktop.
using debug logger
julia> foo() = @debug "Hello, World!";
julia> foo()
julia> withenv("JULIA_DEBUG" => "all") do
foo()
end
┌ Debug: Hello, World!
└ @ Main REPL[1]:1
julia> using Logging
julia> logger = ConsoleLogger(stderr, Logging.Debug);
julia> with_logger(logger) do
foo()
end
┌ Debug: Hello, World!
└ @ Main REPL[1]:1
julia> global_logger(logger)
ConsoleLogger(Base.TTY(RawFD(0x0000000f) open, 0 bytes waiting), Info, Logging.default_metafmt, true, 0, Dict{Any,Int64}())
julia> foo()
┌ Debug: Hello, World!
└ @ Main REPL[1]:1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment