Skip to content

Commit

Permalink
micro fix
Browse files Browse the repository at this point in the history
Signed-off-by: Lixia (Sylvia) Lei <[email protected]>
  • Loading branch information
Wwwsylvia committed Dec 5, 2024
1 parent 050a8e4 commit b467137
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions internal/trace/text_formatter.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ func (f *TextFormatter) Format(entry *logrus.Entry) ([]byte, error) {
timestamp := entry.Time.Format(time.RFC3339Nano)
levelText := strings.ToUpper(entry.Level.String())
fmt.Fprintf(&buf, "[%s][%s]: %s\n", timestamp, levelText, entry.Message)
// printing data fields
if len(entry.Data) != 0 {
// print data fields
if len(entry.Data) > 0 {
buf.WriteString("[Data]:\n")
for k, v := range entry.Data {
fmt.Fprintf(&buf, " %s=%v\n", k, v)
Expand Down
2 changes: 1 addition & 1 deletion internal/trace/transport_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ func Test_logResponseBody(t *testing.T) {
{
name: "Body at the limit",
resp: &http.Response{
Body: io.NopCloser(bytes.NewReader(bytes.Repeat([]byte("a"), int(payloadSizeLimit)))), // 1 byte larger than limit
Body: io.NopCloser(bytes.NewReader(bytes.Repeat([]byte("a"), int(payloadSizeLimit)))),
ContentLength: payloadSizeLimit,
Header: http.Header{"Content-Type": []string{"text/plain"}},
},
Expand Down

0 comments on commit b467137

Please sign in to comment.