Log (eg depwarn) message source full path

question

#1

I am in the process of updating julia-repl.el, the Emacs mode for interacting with the Julia REPL, to work with v0.7. A particular feature is to make source locations “clickable”, this works by recognizing regexps like

at \\([^ ><()\t\n,'\";:]+\\):\\([0-9]+\\)

in error messages like

┌ Warning: `chol(A::AbstractMatrix)` is deprecated, use `(cholesky(A)).U` instead.
│   caller = decompose_variance(::Array{Float64,2}) at utilities.jl:40
└ @ IndirectLikelihood utilities.jl:40

so utilities.jl:40 is recognized as a filename:linenum.

It would be most convenient to have the full path again (like in v0.6). I am still learning about the new logging framework, but I wonder if this is possible somehow.


#2

Not an answer to your question, but I wonder if the logging message should print the full path instead of just the filename. This has annoyed me alot when trying to find depwarns, since often packages have a file src/foo.jl accompanied with test/foo.jl and it is impossible to know which one you should look in.


#3

I agree. I will wait for some discussion, and then open an issue.


#4

Turns out that SimpleLogger prints it in full:

shell> cat foo.jl
foo() = @warn "warning"

julia> include("foo.jl")
foo (generic function with 1 method)

julia> foo()
┌ Warning: warning
└ @ Main foo.jl:1

julia> Base.CoreLogging.global_logger(Base.CoreLogging.SimpleLogger(stderr))
Logging.ConsoleLogger(Base.TTY(RawFD(0x0000000f) open, 0 bytes waiting), Info, Logging.default_metafmt, true, 0, Dict{Any,Int64}())

julia> foo()
┌ Warning: warning
└ @ Main /home/fredrik/julia-master/foo.jl:1

#5

See https://github.com/JuliaLang/julia/pull/27953