feat: add structured logging throughout audio pipeline

Add a lightweight log package (log/log.go) with debug/info/warn/error
levels. Wire it up via a -log flag (default: warn). Logging covers:

UDP transport:
- Socket open/failure, CryptSetup receipt, crypto initialization
- First UDP audio send confirmation
- UDP read errors and packet counts
- TCP fallback reason (no socket, waiting for crypto)

Audio pipeline:
- Source (mic) routine start with config details
- Audio stream start/end per remote user
- First audio stream creation for each user
- Packet loss detection with sequence gaps and PLC generation
- Decoder reset on sequence reordering

Usage: barnard -log=debug -server=mumble.example.com
Levels: debug, info, warn, error
This commit is contained in:
Brandon McGinty (deepseek)
2026-08-08 22:19:42 -04:00
committed by Brandon McGinty
parent a218493eb0
commit e483512f74
7 changed files with 198 additions and 5 deletions
+19
View File
@@ -15,6 +15,8 @@ import (
"strings"
"syscall"
barnlog "git.stormux.org/storm/barnard/log"
"git.stormux.org/storm/barnard/config"
"git.stormux.org/storm/barnard/gumble/go-openal/openal"
"git.stormux.org/storm/barnard/gumble/gumble"
@@ -114,9 +116,26 @@ func main() {
buffers := flag.Int("buffers", 16, "number of audio buffers to use")
profile := flag.Bool("profile", false, "add http server to serve profiles")
noiseSuppressionEnabled := flag.Bool("noise-suppression", false, "enable noise suppression for microphone input")
logLevel := flag.String("log", "warn", "log level: debug, info, warn, error")
flag.Parse()
// Set up logging
var level barnlog.Level
switch strings.ToLower(*logLevel) {
case "debug":
level = barnlog.LevelDebug
case "info":
level = barnlog.LevelInfo
case "warn":
level = barnlog.LevelWarn
case "error":
level = barnlog.LevelError
default:
level = barnlog.LevelWarn
}
barnlog.SetLogger(barnlog.NewWriterLogger(os.Stderr, level))
if *profile == true {
go func() {
log.Println(http.ListenAndServe("localhost:6060", nil))