Skip to content

Commit

Permalink
Messages send to log should not be truncated (networkservicemesh#1966)
Browse files Browse the repository at this point in the history
Messages send to log should not be truncated

Signed-off-by: Andrey Sobolev <[email protected]>
  • Loading branch information
haiodo authored and Nikolay Nikolaev committed Dec 9, 2019
1 parent 27b4bfe commit 7d112ce
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions pkg/tools/spanhelper/span_helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,17 +110,15 @@ func (s *spanHelper) LogObject(attribute string, value interface{}) {
} else {
msg = fmt.Sprint(msg)
}
msg = limitString(msg)
if s.span != nil {
s.span.LogFields(log.Object(attribute, msg))
s.span.LogFields(log.Object(attribute, limitString(msg)))
}
logrus.Infof(">><<%s %s=%v span=%v", strings.Repeat("--", traceDepth(s.ctx)), attribute, msg, s.span)
}

func (s *spanHelper) LogValue(attribute string, value interface{}) {
if s.span != nil {
msg := limitString(fmt.Sprint(value))
s.span.LogFields(log.Object(attribute, msg))
s.span.LogFields(log.Object(attribute, limitString(fmt.Sprint(value))))
}
logrus.Infof(">><<%s %s=%v span=%v", strings.Repeat("--", traceDepth(s.ctx)), attribute, value, s.span)
}
Expand Down

0 comments on commit 7d112ce

Please sign in to comment.