Slightly less verbose xdr trace

This commit is contained in:
Jakob Borg 2014-05-17 08:49:30 +02:00
parent 13022817d4
commit 1442d6f4c2
2 changed files with 15 additions and 3 deletions

15
xdr/debug.go Normal file
View 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

View File

@ -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