# Update variable in logged message without printing a new line?

**URL:** https://discourse.julialang.org/t/update-variable-in-logged-message-without-printing-a-new-line/32755
**Category:** General Usage
**Created:** [December 28, 2019, 2:23pm UTC](https://discourse.julialang.org/t/update-variable-in-logged-message-without-printing-a-new-line/32755 "2019-12-28T14:23:00Z")
**Posts on this page:** 1
**Showing post:** 3

<div class="post-metadata">

### Author: ![swissr](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/swissr/32/208_2.png) [@swissr](https://discourse.julialang.org/u/swissr)
#### Post date: [December 28, 2019, 10:31pm UTC](https://discourse.julialang.org/t/update-variable-in-logged-message-without-printing-a-new-line/32755/3 "2019-12-28T22:31:28Z")

</div>

For a quick and dirty alternative you could use an [ANSI escape code](https://en.wikipedia.org/wiki/Ansi_escape_codes#Escape_sequences) to move the cursor back 1000 positions after printing the string (we are at the start of the line again).

```julia
function testlog()
    i = 1
    for n in 1:5
        print("Processing file number $i\u001b[1000D")
        sleep(0.3) # simulate some work
        i += 1
    end
end

testlog()

```

---

_[View the full topic](https://discourse.julialang.org/t/update-variable-in-logged-message-without-printing-a-new-line/32755)._
