Do not log pings, pongs or game listings

This commit is contained in:
Trevor Slocum 2023-09-30 11:39:30 -07:00
parent bb716d69b9
commit cc53c885e7
3 changed files with 9 additions and 3 deletions

View file

@ -172,7 +172,7 @@ func logClientRead(msg []byte) {
}
}
log.Printf("<- %s %s %s", split[0], username, password)
} else {
} else if !bytes.HasPrefix(msgLower, []byte("list")) && !bytes.HasPrefix(msgLower, []byte("ls")) && !bytes.HasPrefix(msgLower, []byte("pong")) {
log.Printf("<- %s", msg)
}
}

View file

@ -2,6 +2,7 @@ package main
import (
"bufio"
"bytes"
"log"
"net"
"sync"
@ -100,7 +101,9 @@ func (c *socketClient) writeEvents() {
continue
}
log.Printf("-> %s", event)
if !bytes.HasPrefix(event, []byte(`{"Type":"ping"`)) && !bytes.HasPrefix(event, []byte(`{"Type":"list"`)) {
log.Printf("-> %s", event)
}
c.wgEvents.Done()
}
}

View file

@ -1,6 +1,7 @@
package main
import (
"bytes"
"log"
"net"
"net/http"
@ -109,7 +110,9 @@ func (c *webSocketClient) writeEvents() {
continue
}
log.Printf("-> %s", event)
if !bytes.HasPrefix(event, []byte(`{"Type":"ping"`)) && !bytes.HasPrefix(event, []byte(`{"Type":"list"`)) {
log.Printf("-> %s", event)
}
c.wgEvents.Done()
}
}