Skip to content

Commit

Permalink
echo: fmt logs
Browse files Browse the repository at this point in the history
  • Loading branch information
ignoramous committed Jun 23, 2023
1 parent f8f2a9c commit 86f4572
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions midway/echo.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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())
Expand Down

0 comments on commit 86f4572

Please sign in to comment.