gotd: don't log uploaded bytes
This commit is contained in:
@@ -2,6 +2,7 @@ package manager
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"fmt"
|
||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
@@ -113,17 +114,22 @@ func (c *Conn) trackInvoke() func(bin.Encoder, bin.Decoder, *error) {
|
|||||||
end := c.clock.Now()
|
end := c.clock.Now()
|
||||||
c.latest = end
|
c.latest = end
|
||||||
|
|
||||||
var respField zap.Field
|
var respField, reqField zap.Field
|
||||||
if *retErr != nil {
|
if *retErr != nil {
|
||||||
respField = zap.Error(*retErr)
|
respField = zap.Error(*retErr)
|
||||||
} else if _, isFile := output.(*tg.UploadFileBox); !isFile {
|
} else if _, isFile := output.(*tg.UploadFileBox); !isFile {
|
||||||
respField = zap.Any("response_payload", output)
|
respField = zap.Any("response_payload", output)
|
||||||
}
|
}
|
||||||
|
if f, isFile := input.(*tg.UploadSaveFilePartRequest); isFile {
|
||||||
|
reqField = zap.String("request_payload", fmt.Sprintf("%d bytes for part %d of %d", len(f.Bytes), f.FilePart, f.FileID))
|
||||||
|
} else {
|
||||||
|
reqField = zap.Any("request_payload", input)
|
||||||
|
}
|
||||||
|
|
||||||
c.log.Debug("Request completed",
|
c.log.Debug("Request completed",
|
||||||
zap.Duration("duration", end.Sub(start)),
|
zap.Duration("duration", end.Sub(start)),
|
||||||
zap.Int("ongoing", c.ongoing),
|
zap.Int("ongoing", c.ongoing),
|
||||||
zap.Any("request_payload", input),
|
reqField,
|
||||||
respField,
|
respField,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user