Merge pull request #598 from nspcc-dev/loging-fixes

Logging fixes
This commit is contained in:
Vsevolod 2020-01-13 17:37:06 +03:00 committed by GitHub
commit fe7cca7cc4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 17 additions and 16 deletions

View file

@ -134,6 +134,7 @@ func handleLoggingParams(ctx *cli.Context, cfg config.ApplicationConfiguration)
cc.EncoderConfig.EncodeTime = zapcore.ISO8601TimeEncoder
cc.Encoding = "console"
cc.Level = zap.NewAtomicLevelAt(level)
cc.Sampling = nil
if logPath := cfg.LogPath; logPath != "" {
if err := io.MakeDirForFile(logPath, "logger"); err != nil {

View file

@ -82,22 +82,22 @@ func (t *TCPTransport) handleConn(conn net.Conn) {
t.server.register <- p
// When a new peer is connected we send out our version immediately.
if err := t.server.sendVersion(p); err != nil {
t.log.Error("error on sendVersion", zap.Stringer("addr", p.RemoteAddr()), zap.Error(err))
}
r := io.NewBinReaderFromIO(p.conn)
for {
msg := &Message{}
err = msg.Decode(r)
err = t.server.sendVersion(p)
if err == nil {
r := io.NewBinReaderFromIO(p.conn)
for {
msg := &Message{}
err = msg.Decode(r)
if err == payload.ErrTooManyHeaders {
t.log.Warn("not all headers were processed")
r.Err = nil
} else if err != nil {
break
}
if err = t.server.handleMessage(p, msg); err != nil {
break
if err == payload.ErrTooManyHeaders {
t.log.Warn("not all headers were processed")
r.Err = nil
} else if err != nil {
break
}
if err = t.server.handleMessage(p, msg); err != nil {
break
}
}
}
t.server.unregister <- peerDrop{p, err}

View file

@ -99,7 +99,7 @@ func (s *Server) requestHandler(w http.ResponseWriter, httpRequest *http.Request
}
func (s *Server) methodHandler(w http.ResponseWriter, req *Request, reqParams Params) {
s.log.Info("processing rpc request",
s.log.Debug("processing rpc request",
zap.String("method", req.Method),
zap.String("params", fmt.Sprintf("%v", reqParams)))