Commit e2988d03 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent acc03ca1
...@@ -77,6 +77,8 @@ func (r *request) clear() { ...@@ -77,6 +77,8 @@ func (r *request) clear() {
r.readResult = nil r.readResult = nil
} }
const debugDataDumpMax = 8 // maximum #bytes of request/response data to dump
func (r *request) InputDebug() string { func (r *request) InputDebug() string {
val := "" val := ""
if r.handler.DecodeIn != nil { if r.handler.DecodeIn != nil {
...@@ -89,7 +91,13 @@ func (r *request) InputDebug() string { ...@@ -89,7 +91,13 @@ func (r *request) InputDebug() string {
} }
if len(r.arg) > 0 { if len(r.arg) > 0 {
names += fmt.Sprintf(" %db", len(r.arg)) l := len(r.arg)
s := ""
if l > debugDataDumpMax {
l = debugDataDumpMax
s = "..."
}
names += fmt.Sprintf(" %db %q%s", len(r.arg), r.arg[:l], s)
} }
return fmt.Sprintf("rx %d: %s i%d %s%s", return fmt.Sprintf("rx %d: %s i%d %s%s",
...@@ -120,13 +128,13 @@ func (r *request) OutputDebug() string { ...@@ -120,13 +128,13 @@ func (r *request) OutputDebug() string {
} else { } else {
l := len(r.flatData) l := len(r.flatData)
s := "" s := ""
if l > 8 { if l > debugDataDumpMax {
l = 8 l = debugDataDumpMax
s = "..." s = "..."
} }
spl = fmt.Sprintf(" %q%s", r.flatData[:l], s) spl = fmt.Sprintf(" %q%s", r.flatData[:l], s)
} }
flatStr = fmt.Sprintf(" %db data%s", r.flatDataSize(), spl) flatStr = fmt.Sprintf(" %db %s", r.flatDataSize(), spl)
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment