Access logged values

I think I wasn’t clear enough. Here is an example.

function f(x)
y = 2x
@warn "something wrong" y
end

Then at the REPL, or somewhereelse

julia> f(2)
┌ Warning: something wrong
│   y = 4
└ @ Main REPL[1]:3

At this point, how do I access the value of y programmatically? Is there something like LoggedValues[:y] that returns the value of y when the message was issued?

Suppose that y here is actually a complicated struct, so just looking at the printed value is no help.

1 Like