include stats in error log when encoding stats fails

This commit is contained in:
Henry Dollman
2025-01-05 17:58:38 -05:00
parent 9619e6cf89
commit 1ac165d7d3

View File

@@ -26,7 +26,7 @@ func (a *Agent) startServer(pubKey []byte, addr string) {
func (a *Agent) handleSession(s sshServer.Session) { func (a *Agent) handleSession(s sshServer.Session) {
stats := a.gatherStats() stats := a.gatherStats()
if err := json.NewEncoder(s).Encode(stats); err != nil { if err := json.NewEncoder(s).Encode(stats); err != nil {
slog.Error("Error encoding stats", "err", err) slog.Error("Error encoding stats", "err", err, "stats", stats)
s.Exit(1) s.Exit(1)
return return
} }