antplusbridge/cmd/bridge/log.go
Erik Brakkee b24513fcc3 feat: add CLI with Cobra and timestamped logging
Introduce structured CLI argument parsing using Cobra with three
configurable flags:
  --vendor: USB vendor ID (default: 0x0fcf)
  --product: USB product ID (default: 0x1008)
  --device: ANT+ device number (default: 3001)

Add timestamped logging for all log statements with format
YYYY-MM-DD HH:MM:SS. Log vendor, product, and device values at
startup in both hex and decimal.

Remove hardcoded USB identifiers from main.go and consolidate all
startup logic into cli.go with a dedicated Config struct.

Update ant.go ListenForTrainer signature to accept uint16 for
vendor and product IDs.
2026-05-27 00:36:06 +02:00

19 lines
325 B
Go

package main
import (
"fmt"
"time"
)
func logMsg(msg string) {
fmt.Println(time.Now().Format("2006-01-02 15:04:05") + " " + msg)
}
func logPrintf(format string, a ...any) {
fmt.Printf(time.Now().Format("2006-01-02 15:04:05")+" "+format, a...)
}
func logMsgf(format string, a ...any) {
logPrintf(format+"\n", a...)
}