I’m wondering if it’s possible to update a logged message without printing a new line. I’d like to log some information to the console on each iteration of a loop but, rather than printing a new @info
statement on each iteration, I’d like to simply update the existing message to reflect the new value of the variable.
For example, instead of this:
function testlog()
i = 1
for n in 1:5
@info "Processing file number $i"
i += 1
end
end
julia> testlog()
[ Info: Processing file number 1
[ Info: Processing file number 2
[ Info: Processing file number 3
[ Info: Processing file number 4
[ Info: Processing file number 5
I’d like to be able to do something like this:
function testlog()
i = 1
@info "Processing file number $i"
for n in 1:5
i += 1
end
end
julia> testlog()
[ Info: Processing file number 1 # This updates on each iteration
Is this possible? If not, is it possible to have the “processing file number #” print as part of the same Info
statement? What I mean is, instead of the word “Info” showing up, can I just append the message to an existing @info
event? It would look something like this:
[ Info: Processing file number 1
| Processing file number 2
| Processing file number 3
....