Remove Trace method and replace its calls with Debug

This commit is contained in:
M. Mert Yildiran
2021-10-18 18:07:24 +03:00
parent c5e43313da
commit 4f760ada79
2 changed files with 4 additions and 7 deletions

View File

@@ -124,9 +124,6 @@ func SilentError(t string, s string, a ...interface{}) {
func Debug(s string, a ...interface{}) { func Debug(s string, a ...interface{}) {
logger.Log.Debugf(s, a...) logger.Log.Debugf(s, a...)
} }
func Trace(s string, a ...interface{}) {
logger.Log.Infof(s, a...)
}
func inArrayInt(arr []int, valueToCheck int) bool { func inArrayInt(arr []int, valueToCheck int) bool {
for _, value := range arr { for _, value := range arr {

View File

@@ -108,7 +108,7 @@ func (t *tcpStream) ReassembledSG(sg reassembly.ScatterGather, ac reassembly.Ass
} else { } else {
ident = fmt.Sprintf("%v %v(%s): ", t.net.Reverse(), t.transport.Reverse(), dir) ident = fmt.Sprintf("%v %v(%s): ", t.net.Reverse(), t.transport.Reverse(), dir)
} }
Trace("%s: SG reassembled packet with %d bytes (start:%v,end:%v,skip:%d,saved:%d,nb:%d,%d,overlap:%d,%d)", ident, length, start, end, skip, saved, sgStats.Packets, sgStats.Chunks, sgStats.OverlapBytes, sgStats.OverlapPackets) Debug("%s: SG reassembled packet with %d bytes (start:%v,end:%v,skip:%d,saved:%d,nb:%d,%d,overlap:%d,%d)", ident, length, start, end, skip, saved, sgStats.Packets, sgStats.Chunks, sgStats.OverlapBytes, sgStats.OverlapPackets)
if skip == -1 && *allowmissinginit { if skip == -1 && *allowmissinginit {
// this is allowed // this is allowed
} else if skip != 0 { } else if skip != 0 {
@@ -127,7 +127,7 @@ func (t *tcpStream) ReassembledSG(sg reassembly.ScatterGather, ac reassembly.Ass
} }
dnsSize := binary.BigEndian.Uint16(data[:2]) dnsSize := binary.BigEndian.Uint16(data[:2])
missing := int(dnsSize) - len(data[2:]) missing := int(dnsSize) - len(data[2:])
Trace("dnsSize: %d, missing: %d", dnsSize, missing) Debug("dnsSize: %d, missing: %d", dnsSize, missing)
if missing > 0 { if missing > 0 {
Debug("Missing some bytes: %d", missing) Debug("Missing some bytes: %d", missing)
sg.KeepFrom(0) sg.KeepFrom(0)
@@ -138,7 +138,7 @@ func (t *tcpStream) ReassembledSG(sg reassembly.ScatterGather, ac reassembly.Ass
if err != nil { if err != nil {
SilentError("DNS-parser", "Failed to decode DNS: %v", err) SilentError("DNS-parser", "Failed to decode DNS: %v", err)
} else { } else {
Trace("DNS: %s", gopacket.LayerDump(dns)) Debug("DNS: %s", gopacket.LayerDump(dns))
} }
if len(data) > 2+int(dnsSize) { if len(data) > 2+int(dnsSize) {
sg.KeepFrom(2 + int(dnsSize)) sg.KeepFrom(2 + int(dnsSize))
@@ -173,7 +173,7 @@ func (t *tcpStream) ReassembledSG(sg reassembly.ScatterGather, ac reassembly.Ass
} }
func (t *tcpStream) ReassemblyComplete(ac reassembly.AssemblerContext) bool { func (t *tcpStream) ReassemblyComplete(ac reassembly.AssemblerContext) bool {
Trace("%s: Connection closed", t.ident) Debug("%s: Connection closed", t.ident)
if t.isTapTarget && !t.isClosed { if t.isTapTarget && !t.isClosed {
t.Close() t.Close()
} }