slog: TextHandler uses %+v

In the general case, format values with %+v instead of %v.
This adds struct field names to the output.

Change-Id: Ib53f5e3a8837aa987deb4b6ba3dd7f549a54e2ce
Reviewed-on: https://go-review.googlesource.com/c/exp/+/476435
Run-TryBot: Jonathan Amsterdam <jba@google.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
diff --git a/slog/text_handler.go b/slog/text_handler.go
index 0be3553..0faa367 100644
--- a/slog/text_handler.go
+++ b/slog/text_handler.go
@@ -111,7 +111,7 @@
 			s.buf.WriteString(strconv.Quote(string(bs)))
 			return nil
 		}
-		s.appendString(fmt.Sprint(v.Any()))
+		s.appendString(fmt.Sprintf("%+v", v.Any()))
 	default:
 		*s.buf = v.append(*s.buf)
 	}
diff --git a/slog/text_handler_test.go b/slog/text_handler_test.go
index d88d20c..71f637a 100644
--- a/slog/text_handler_test.go
+++ b/slog/text_handler_test.go
@@ -35,11 +35,16 @@
 			`"x = y"`, `"qu\"o"`,
 		},
 		{
-			"Sprint",
+			"String method",
 			Any("name", name{"Ren", "Hoek"}),
 			`name`, `"Hoek, Ren"`,
 		},
 		{
+			"struct",
+			Any("x", &struct{ A, b int }{A: 1, b: 2}),
+			`x`, `"&{A:1 b:2}"`,
+		},
+		{
 			"TextMarshaler",
 			Any("t", text{"abc"}),
 			`t`, `"text{\"abc\"}"`,