fix: tx-debug-udp 日志的写入以及发送日志调试
This commit is contained in:
@@ -7,14 +7,16 @@ import (
|
||||
|
||||
"omnisocketgo/cmd/internal/latencylog"
|
||||
"omnisocketgo/cmd/internal/server"
|
||||
"omnisocketgo/cmd/internal/transport"
|
||||
)
|
||||
|
||||
func main() {
|
||||
listenAddr := flag.String("listen", ":9001", "UDP server listen address")
|
||||
logPath := flag.String("latency-log", "", "optional JSONL file path for latency timestamp logs")
|
||||
txTimestampDebugLogPath := flag.String("tx-ts-debug-log", "", "optional JSONL file path for TX errqueue debug records")
|
||||
flag.Parse()
|
||||
|
||||
hubOptions := make([]server.UDPOption, 0, 1)
|
||||
hubOptions := make([]server.UDPOption, 0, 2)
|
||||
if *logPath != "" {
|
||||
logger, err := latencylog.NewJSONLLogger(*logPath)
|
||||
if err != nil {
|
||||
@@ -23,6 +25,14 @@ func main() {
|
||||
defer logger.Close()
|
||||
hubOptions = append(hubOptions, server.WithUDPLogger(logger))
|
||||
}
|
||||
if *txTimestampDebugLogPath != "" {
|
||||
logger, err := transport.NewJSONLTXTimestampDebugLogger(*txTimestampDebugLogPath)
|
||||
if err != nil {
|
||||
log.Fatalf("create tx timestamp debug logger %s: %v", *txTimestampDebugLogPath, err)
|
||||
}
|
||||
defer logger.Close()
|
||||
hubOptions = append(hubOptions, server.WithUDPTXTimestampDebugLogger(logger))
|
||||
}
|
||||
|
||||
udpAddr, err := net.ResolveUDPAddr("udp", *listenAddr)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user