mirror of
https://github.com/octoleo/syncthing.git
synced 2024-12-22 19:08:58 +00:00
Slightly less verbose xdr trace
This commit is contained in:
parent
13022817d4
commit
1442d6f4c2
15
xdr/debug.go
Normal file
15
xdr/debug.go
Normal file
@ -0,0 +1,15 @@
|
||||
package xdr
|
||||
|
||||
import (
|
||||
"os"
|
||||
"strings"
|
||||
|
||||
"github.com/calmh/syncthing/logger"
|
||||
)
|
||||
|
||||
var (
|
||||
debug = strings.Contains(os.Getenv("STTRACE"), "xdr") || os.Getenv("STTRACE") == "all"
|
||||
dl = logger.DefaultLogger
|
||||
)
|
||||
|
||||
const maxDebugBytes = 32
|
@ -48,9 +48,6 @@ func (r *Reader) ReadBytesMaxInto(max int, dst []byte) []byte {
|
||||
if r.err != nil {
|
||||
return nil
|
||||
}
|
||||
if debug {
|
||||
dl.Debugf("rd bytes len=%d", l)
|
||||
}
|
||||
if max > 0 && l > max {
|
||||
r.err = ErrElementSizeExceeded
|
||||
return nil
|
||||
|
Loading…
Reference in New Issue
Block a user