X-Git-Url: http://www.git.cypherpunks.ru/?a=blobdiff_plain;f=src%2Fcypherpunks.ru%2Fgovpn%2Fstats.go;h=2f6c5170f7654047c5011790d682c399f3457c37;hb=c4ce2306df402e03b7fd0f2f10e07cf21b2babc2;hp=2fa90e49f39bb24799b608a349e9ea5cf9fea99b;hpb=012173bd090f87e8dffbc124f41425eef8a9a7f8;p=govpn.git diff --git a/src/cypherpunks.ru/govpn/stats.go b/src/cypherpunks.ru/govpn/stats.go index 2fa90e4..2f6c517 100644 --- a/src/cypherpunks.ru/govpn/stats.go +++ b/src/cypherpunks.ru/govpn/stats.go @@ -46,7 +46,9 @@ func StatsProcessor(stats string, peers *KnownPeers) { "port": stats, } - logger.WithFields(fields).WithField( + logger.WithFields( + fields, + ).WithField( "port", stats, ).Debug("Stats are going to listen") statsPort, err := net.Listen("tcp", stats) @@ -65,8 +67,11 @@ func StatsProcessor(stats string, peers *KnownPeers) { } deadLine := time.Now().Add(rwTimeout) if err = conn.SetDeadline(deadLine); err != nil { - logger.WithFields(fields).WithField( - "deadline", deadLine.String(), + logger.WithFields( + fields, + ).WithField( + "deadline", + deadLine.String(), ).WithError(err).Error("Can't set deadline") } else if _, err = conn.Read(buf); err != nil { logger.WithFields(fields).WithError(err).Error("Can't read buffer") @@ -78,7 +83,9 @@ func StatsProcessor(stats string, peers *KnownPeers) { peersList = append(peersList, *peer) } if err = json.NewEncoder(conn).Encode(peersList); err != nil { - logger.WithFields(fields).WithField( + logger.WithFields( + fields, + ).WithField( "peers", len(peersList), ).WithError(err).Error("Can't encode to JSON") }