From 86f45729f0f300aac6016eb778e4ddd707584c02 Mon Sep 17 00:00:00 2001 From: Murtaza Aliakbar Date: Fri, 23 Jun 2023 12:25:07 +0530 Subject: [PATCH] echo: fmt logs --- midway/echo.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/midway/echo.go b/midway/echo.go index f7805d1..b1da973 100644 --- a/midway/echo.go +++ b/midway/echo.go @@ -55,7 +55,7 @@ func processudp(c net.PacketConn, uwg *sync.WaitGroup) { continue } - log.Println("umsg: " + n + " - " + string(packet[:n]) + " / by: " + raddr.String()) + log.Printf("umsg: %d - %s / by: %s\n", n, string(packet[:n]), raddr.String()) // echo packet and raddr back c.WriteTo(packet[:n], raddr) c.WriteTo([]byte(raddr.String()), raddr) @@ -112,7 +112,7 @@ func processtcp(c net.Conn) { defer c.Close() line, _ := bufio.NewReader(c).ReadString('\n') - log.Println("tmsg: " + len(line) + " - " + string(line) + " / by: " + c.RemoteAddr().String()) + log.Printf("tmsg: %d - %s / by: %s\n", len(line), string(line), c.RemoteAddr().String()) // echo msg and rip back fmt.Fprint(c, line) fmt.Fprint(c, c.RemoteAddr())