air-verse / air

☁️ Live reload for Go apps
GNU General Public License v3.0
18.25k stars 814 forks source link

How to suppress stdout from 'air'? #201

Open jsfag opened 3 years ago

jsfag commented 3 years ago

It's freaking annoying:

image
bartek commented 3 years ago

I don't believe there's a way to suppress the logging in any global way, except increase it (via -d debug mode)

The logging configuration is limited to adding time and in tracing the calls to the logger (example starting point), there doesn't seem to be any checks around configuration for writing each line.

It seems like a good configuration that could exist in the toml file and be used when initializing the logger.

silverwind commented 3 years ago

It'd be nice to be able to selectively suppress stuff like the watching <something> lines. On big projects, it spams the terminal with hundrets of useless lines which is rather annoying.

ThomasJanUta commented 2 years ago

I just started using air. Installing, configuring, running air is great except that you get blasted with noise:


  __    _   ___
 / /\  | | | |_)
/_/--\ |_| |_| \_ , built with Go

watching .
watching __pycache__
watching __pycache__
!exclude log
!exclude log
!exclude pkg
watching py
watching py
watching py\__pycache__
watching py\__pycache__
watching py\__pycache__
watching py\secret
watching py\secret
watching py\secret
watching py\util
watching py\util
watching py\util
watching py\util\__pycache__
watching py\util\__pycache__
watching py\util\__pycache__
watching py\util\__pycache__
!exclude res
!exclude res
watching src
watching src\config
watching src\secret
watching src\exec
watching src\http
watching src\util
building...
running...

This is all useless including the duplicated paths. I know that I am using AIR, I know how the project looks like.

Adding some kind of silent mode in the configuration would work wonders:

[log]
  time = false
  silent = true  # enable silent mode for air-related logs but keep the logging from my application

@xiantang @cosmtrek Could you comment where in the code you would inject an "escape" or flag for silencing the stoud?

silverwind commented 2 years ago

Maybe log levels could be introduced. I'd classify the above "watching" and "exclude" stuff as "debug", for example. "building" and "running" is probably "info".

silverwind commented 5 months ago

https://github.com/air-verse/air/pull/367 does solve this for me personally.

brettinternet commented 3 months ago

367 suppresses air's watcher, build, and runner logs but the version info remains. Is there a way to suppress the version information logging?

  __    _   ___
 / /\  | | | |_)
/_/--\ |_| |_| \_ v1.52.3, built with Go go1.22.4
jesses-code-adventures commented 2 months ago

@brettinternet i have put in #641 that allows a separate flag "silent" that suppresses the version info and the notifications about files being watched/refreshing, so the only output you get is from your app.