# Disable extra information when using @warn

**URL:** https://discourse.julialang.org/t/disable-extra-information-when-using-warn/129826
**Category:** New to Julia
**Tags:** question, logging
**Created:** [June 12, 2025, 6:19am UTC](https://discourse.julialang.org/t/disable-extra-information-when-using-warn/129826 "2025-06-12T06:19:58Z")
**Posts on this page:** 10
**Page:** 1

<div class="post-metadata">

### Author: ![gitboy16](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gitboy16/32/24906_2.png) [@gitboy16](https://discourse.julialang.org/u/gitboy16)
#### Post date: [June 12, 2025, 6:19am UTC](https://discourse.julialang.org/t/disable-extra-information-when-using-warn/129826/1 "2025-06-12T06:19:58Z")

</div>

Hi,  
When I use `@warn` it prints the warning but also where it happened in the script.  
Is there a way to disable that information about the line in the script?  
Thank you.

---

<div class="post-metadata">

### Author: ![karei](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/karei/32/214809_2.png) [@karei](https://discourse.julialang.org/u/karei)
#### Post date: [June 12, 2025, 6:31am UTC](https://discourse.julialang.org/t/disable-extra-information-when-using-warn/129826/2 "2025-06-12T06:31:57Z")

</div>

idk, but if you only want to print colored fonts, you can use `printstyled("warning!!",color=:yellow)`.

---

<div class="post-metadata">

### Author: ![giordano](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/giordano/32/2166_2.png) [@giordano](https://discourse.julialang.org/u/giordano)
#### Post date: [June 12, 2025, 7:49am UTC](https://discourse.julialang.org/t/disable-extra-information-when-using-warn/129826/3 "2025-06-12T07:49:43Z")

</div>

You can use something like LoggingExtras.jl to customise the logging format (you could also use sta functionalities in the Logging stdlib directly, but LoggingExtras.jl provides more user-friendly interface)

---

<div class="post-metadata">

### Author: ![fredrikekre](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/fredrikekre/32/1688_2.png) [@fredrikekre](https://discourse.julialang.org/u/fredrikekre)
#### Post date: [June 12, 2025, 7:58am UTC](https://discourse.julialang.org/t/disable-extra-information-when-using-warn/129826/4 "2025-06-12T07:58:14Z")

</div>

```julia
using Logging, LoggingExtras

# Logger sink that only prints the level and the message
const message_logger = FormatLogger() do io, args
    println(io, "[", args.level, "] ", args.message)
end

# Filter log messages below info
level_filter_logger = EarlyFilteredLogger(message_logger) do args
    return args.level >= Logging.Info
end

# Install the logger
global_logger(level_filter_logger)

```

```julia
julia> @error "hello error"
[Error] hello error

julia> @warn "hello warn"
[Warn] hello warn

julia> @info "hello info"
[Info] hello info

julia> @debug "hello debug"

```

---

<div class="post-metadata">

### Author: ![gitboy16](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gitboy16/32/24906_2.png) [@gitboy16](https://discourse.julialang.org/u/gitboy16)
#### Post date: [June 12, 2025, 8:17am UTC](https://discourse.julialang.org/t/disable-extra-information-when-using-warn/129826/5 "2025-06-12T08:17:45Z")

</div>

Thank you @fredrikekre , I don’t think I would have been able to find that by myself.  
If a Base Julia solution exists, I would prefer it as I had bad experience in the past adding dependencies (packages) to my project.

---

<div class="post-metadata">

### Author: ![abraemer](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/abraemer/32/51403_2.png) [@abraemer](https://discourse.julialang.org/u/abraemer)
#### Post date: [June 12, 2025, 10:41am UTC](https://discourse.julialang.org/t/disable-extra-information-when-using-warn/129826/6 "2025-06-12T10:41:20Z")

</div>

> [@gitboy16](#):
>
> If a Base Julia solution exists, I would prefer it as I had bad experience in the past adding dependencies (packages) to my project.

Well you can ofc copy code from the packages or see how they modify the logging but you won’t get this customization any more easily.  
What kind of issues did you experience with Julia’s package management? In my experience, it works very well and hickups are quite rare. Maybe there is a misconception we can clear up for you? Or do you require some specialized setup (e.g. air-gapped system) that makes the default not applicable for you?

---

<div class="post-metadata">

### Author: ![gitboy16](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gitboy16/32/24906_2.png) [@gitboy16](https://discourse.julialang.org/u/gitboy16)
#### Post date: [June 12, 2025, 8:26pm UTC](https://discourse.julialang.org/t/disable-extra-information-when-using-warn/129826/7 "2025-06-12T20:26:24Z")

</div>

In the past I was using ProgressMeter in my project, one day when I upgraded it, I had a bug that I never manage to fix and I did not raise a issue because I was unable to create a minimum reproducible example. Also the code is behind a corporate firewall so I can’t publish it. I ended up removing ProgressMeter from my project and implemented my own progress bar. All i want to say is that I prefer to have minimal dependencies to my projects cause every dependency has the potential to break it (bug, package not maintained, my inability to understand and fix a bug in a package..etc)  
I was not talking about Julia Package manager, but now that you mention it, the only issue I have is that I am behind a proxy and firewall which prevent it from working with the default configuration. To make it work I have to use the option JULIA\_PKG\_USE\_CLI\_GIT otherwise it does not work and get an error message saying download is slow. (Sorry i don’t remember the exact error message).

---

<div class="post-metadata">

### Author: ![ericphanson](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ericphanson/32/215186_2.png) [@ericphanson](https://discourse.julialang.org/u/ericphanson)
#### Post date: [June 13, 2025, 12:58am UTC](https://discourse.julialang.org/t/disable-extra-information-when-using-warn/129826/8 "2025-06-13T00:58:53Z")

</div>

If you don’t mind modifying the call site you can pass `_file=nothing _module=nothing _line=nothing` like [julia/stdlib/REPL/src/REPL.jl at 7e8e9bb12e2ee3f60b5a5c97b15116784958f5d6 · JuliaLang/julia · GitHub](https://github.com/JuliaLang/julia/blob/7e8e9bb12e2ee3f60b5a5c97b15116784958f5d6/stdlib/REPL/src/REPL.jl#L170)

That’s using internals so it may not work forever though.

---

<div class="post-metadata">

### Author: ![gitboy16](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gitboy16/32/24906_2.png) [@gitboy16](https://discourse.julialang.org/u/gitboy16)
#### Post date: [June 13, 2025, 2:30pm UTC](https://discourse.julialang.org/t/disable-extra-information-when-using-warn/129826/9 "2025-06-13T14:30:25Z")

</div>

Thank you very much @ericphanson and I take note of your warning.

---

<div class="post-metadata">

### Author: ![karei](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/karei/32/214809_2.png) [@karei](https://discourse.julialang.org/u/karei)
#### Post date: [June 14, 2025, 2:42am UTC](https://discourse.julialang.org/t/disable-extra-information-when-using-warn/129826/10 "2025-06-14T02:42:25Z")

</div>

You can try [Progress bars · Term.jl](https://fedeclaudi.github.io/Term.jl/dev/adv/progressbars/)
