尝试写一个日志管理 以协议为控制粒度

This commit is contained in:
impact-eintr
2022-12-08 19:33:21 +08:00
parent 9a46ec9db5
commit 478d7cbc71
4 changed files with 63 additions and 4 deletions

View File

@@ -3,6 +3,7 @@ package tcp
import (
"fmt"
"log"
"netstack/logger"
"netstack/tcpip/buffer"
"netstack/tcpip/header"
"netstack/tcpip/seqnum"
@@ -122,8 +123,10 @@ func (s *segment) parse() bool {
s.options = h.Options()
s.parsedOptions = header.ParseTCPOptions(s.options)
log.Println(h)
fmt.Println(s.parsedOptions)
logger.GetInstance().Info(logger.TCP, func() {
log.Println(h)
fmt.Println(s.parsedOptions)
})
s.data.TrimFront(offset)