-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
logging() in .juliarc.jl does not work #24028
Comments
In theory the new infrastructure allows you to do what you want, but it's immature and there's still various things to fix. Can you show the exact code which triggers the warning which you're trying to silence? |
Here is the code I wanted to silence: logging(DevNull,Base,:show_delim_array;kind=:warn)
logging(DevNull,Main,:show_delim_array;kind=:warn)
import Base.show_delim_array function show_delim_array(io::IO, itr::Union{AbstractArray,SimpleVector}, op, delim, cl,
delim_one, i1=first(linearindices(itr)), l=last(linearindices(itr)))
print(io, op)
if !Base.show_circular(io, itr)
recur_io = IOContext(io, :SHOWN_SET => itr)
if !haskey(io, :compact)
recur_io = IOContext(recur_io, :compact => true)
end
first = true
i = i1
if l >= i1
while true
if !isassigned(itr, i)
print(io, undef_ref_str)
else
x = itr[i]
show(recur_io, x)
end
i += 1
if i > l
delim_one && first && print(io, delim)
break
end
first = false
print(io, delim)
end
end
end
print(io, cl)
end function show_delim_array(io::IO, itr, op, delim, cl, delim_one, i1=1, n=typemax(Int))
print(io, op)
if !Base.show_circular(io, itr)
recur_io = IOContext(io, :SHOWN_SET => itr)
state = start(itr)
first = true
while i1 > 1 && !done(itr, state)
_, state = next(itr, state)
i1 -= 1
end
if !done(itr, state)
while true
x, state = next(itr, state)
show(recur_io, x)
i1 += 1
if done(itr, state) || i1 > n
delim_one && first && print(io, delim)
break
end
first = false
print(io, delim)
end
end
end
print(io, cl)
end It's to make the display output of Array's back to the way it was before (without spaces). |
Thanks - that confirms the associated warning "WARNING: Method definition ... overwritten at ..." is coming from the runtime in |
This is an issue related to #16213
The
logging
function does not have any effect when used from.juliarc.jl
For example, in my case I needed to overwrite the
Base.show_delim_array
method so I usedas explained on discourse
Using this in the REPL after julia has loaded is no problem, but it does not work from
.juliarc.jl
and the warnings are still displayed anyway.The text was updated successfully, but these errors were encountered: