diff options
author | Igor Drozdov <idrozdov@gitlab.com> | 2021-07-22 17:58:58 +0300 |
---|---|---|
committer | Igor Drozdov <idrozdov@gitlab.com> | 2021-07-22 18:38:47 +0300 |
commit | fb7b9417842c66e12466e658e861e19619dfcd9a (patch) | |
tree | d0d49465ee51299ed97f404e1aeebd92b6f9ff9e /internal/sshd/connection.go | |
parent | a8b2088d6d40e365445fcf4bea5183f83e31cc51 (diff) | |
download | gitlab-shell-fb7b9417842c66e12466e658e861e19619dfcd9a.tar.gz |
Switch to labkit/log for logging functionality
Diffstat (limited to 'internal/sshd/connection.go')
-rw-r--r-- | internal/sshd/connection.go | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/internal/sshd/connection.go b/internal/sshd/connection.go index 5ff055c..0e0da93 100644 --- a/internal/sshd/connection.go +++ b/internal/sshd/connection.go @@ -4,11 +4,12 @@ import ( "context" "time" - log "github.com/sirupsen/logrus" "golang.org/x/crypto/ssh" "golang.org/x/sync/semaphore" "gitlab.com/gitlab-org/gitlab-shell/internal/metrics" + + "gitlab.com/gitlab-org/labkit/log" ) type connection struct { @@ -42,7 +43,7 @@ func (c *connection) handle(ctx context.Context, chans <-chan ssh.NewChannel, ha } channel, requests, err := newChannel.Accept() if err != nil { - log.Infof("Could not accept channel: %v", err) + log.WithError(err).Info("could not accept channel") c.concurrentSessions.Release(1) continue } @@ -53,7 +54,7 @@ func (c *connection) handle(ctx context.Context, chans <-chan ssh.NewChannel, ha // Prevent a panic in a single session from taking out the whole server defer func() { if err := recover(); err != nil { - log.Warnf("panic handling session from %s: recovered: %#+v", c.remoteAddr, err) + log.WithFields(log.Fields{"recovered_error": err}).Warnf("panic handling session from %s", c.remoteAddr) } }() |