#353·MailHog

Request: Remove printing about "[APIv1] KEEPALIVE /api/v1/events"

Author: clytrasCreated Feb 26, 2021Updated Apr 11, 2025

Inside api/v1.go we see that the keepalive function uses stream.Notify("keepalive", []byte{}) to, as stated in the comment, keep connections alive.

go
 // keepalive sends an empty keep alive message. 
 // 
 // This not only can keep connections alive, but also will detect broken 
 // connections. Without this it is possible for the server to become 
 // unresponsive due to too many open files. 
 func (apiv1 *APIv1) keepalive() { 
 	log.Println("[APIv1] KEEPALIVE /api/v1/events") 
 	stream.Notify("keepalive", []byte{}) 
 } 

Which will spam an attached console with many messages like this:

mailhog spam

Can we keep the stream.Notify("keepalive", []byte{}) which will do the job and ditch the printing log.Println("[APIv1] KEEPALIVE /api/v1/events")? Or make an enviroment variable flag option to indicate printing that line or not?

In my developer setup (and I believe in others too) I use attached containers to drive every log message to stdout and these event spam messages really bug me up.