From c1b86bbf9c38b3a7ebf165921ce1f4132ab8c103 Mon Sep 17 00:00:00 2001 From: contact Date: Mon, 6 Dec 2021 17:56:00 +0000 Subject: [PATCH] Add username to downstreamConn log messages git-svn-id: file:///srv/svn/repo/suika/trunk@750 f0ae65fe-ee39-954e-97ec-027ff2717ef4 --- downstream.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/downstream.go b/downstream.go index be2faf8..afb6cfc 100644 --- a/downstream.go +++ b/downstream.go @@ -1301,6 +1301,9 @@ func (dc *downstreamConn) welcome(ctx context.Context) error { panic("tried to welcome an unregistered connection") } + remoteAddr := dc.conn.RemoteAddr().String() + dc.logger = &prefixLogger{dc.srv.Logger, fmt.Sprintf("user %q: downstream %q: ", dc.user.Username, remoteAddr)} + // TODO: doing this might take some time. We should do it in dc.register // instead, but we'll potentially be adding a new network and this must be // done in the user goroutine.