From 46f48a947ca2153a1c9640bd103f67a3581a949a Mon Sep 17 00:00:00 2001 From: sawka Date: Tue, 6 Sep 2022 13:00:30 -0700 Subject: [PATCH] better logging for which remote received the packet --- pkg/remote/remote.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/pkg/remote/remote.go b/pkg/remote/remote.go index 8640d5c2..85235762 100644 --- a/pkg/remote/remote.go +++ b/pkg/remote/remote.go @@ -695,7 +695,7 @@ func (msh *MShellProc) handleCmdDonePacket(donePk *packet.CmdDonePacketType) { func (msh *MShellProc) handleCmdErrorPacket(errPk *packet.CmdErrorPacketType) { err := sstore.AppendCmdErrorPk(context.Background(), errPk) if err != nil { - fmt.Printf("[error] adding cmderr: %v\n", err) + fmt.Printf("cmderr> [remote %s] [error] adding cmderr: %v\n", msh.GetRemoteName(), err) return } return @@ -766,7 +766,7 @@ func (msh *MShellProc) ProcessPackets() { } if pk.GetType() == packet.CmdDataPacketStr { dataPacket := pk.(*packet.CmdDataPacketType) - fmt.Printf("cmd-data %s pty=%d run=%d\n", dataPacket.CK, dataPacket.PtyDataLen, dataPacket.RunDataLen) + fmt.Printf("cmd-data> [remote %s] [%s] pty=%d run=%d\n", msh.GetRemoteName(), dataPacket.CK, dataPacket.PtyDataLen, dataPacket.RunDataLen) continue } if pk.GetType() == packet.CmdDonePacketStr { @@ -785,15 +785,15 @@ func (msh *MShellProc) ProcessPackets() { } if pk.GetType() == packet.RawPacketStr { rawPacket := pk.(*packet.RawPacketType) - fmt.Printf("stderr> %s\n", rawPacket.Data) + fmt.Printf("stderr> [remote %s] %s\n", msh.GetRemoteName(), rawPacket.Data) continue } if pk.GetType() == packet.CmdStartPacketStr { startPk := pk.(*packet.CmdStartPacketType) - fmt.Printf("start> reqid=%s (%p)\n", startPk.RespId, msh.ServerProc.Output) + fmt.Printf("start> [remote %s] reqid=%s (%p)\n", msh.GetRemoteName(), startPk.RespId, msh.ServerProc.Output) continue } - fmt.Printf("MSH> unhandled packet %s\n", packet.AsString(pk)) + fmt.Printf("MSH> [remote %s] unhandled packet %s\n", msh.GetRemoteName(), packet.AsString(pk)) } }