Skip to content

Commit 5808228

Browse files
committed
Fix slog.Component handling
1 parent c6adca8 commit 5808228

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

examples_test.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,16 +28,16 @@ func Example_stderr() {
2828
})),
2929
)
3030

31-
// test_test.go:38: Sep 06 14:04:33.028 [INFO]: my_message_here
31+
// test_test.go:17: Sep 06 14:33:34.677 [INFO] (test): my_message_here
3232
// field_name: something or the other
3333
// some_map:
3434
// nested_fields: wowow
3535
// error:
3636
// - msg: wrap2
37-
// loc: /Users/nhooyr/src/cdr/slog/test_test.go:43
37+
// loc: /Users/nhooyr/src/cdr/slog/test_test.go:22
3838
// fun: go.coder.com/slog_test.TestExampleStderr
3939
// - msg: wrap1
40-
// loc: /Users/nhooyr/src/cdr/slog/test_test.go:44
40+
// loc: /Users/nhooyr/src/cdr/slog/test_test.go:23
4141
// fun: go.coder.com/slog_test.TestExampleStderr
4242
// - EOF
4343
// name: wow
@@ -66,16 +66,16 @@ func Example_test() {
6666
)
6767

6868
// --- PASS: TestExampleTest (0.00s)
69-
// test_test.go:16: Sep 06 14:04:08.947 [INFO]: my_message_here
69+
// test_test.go:38: Sep 06 14:33:52.628 [INFO] (test): my_message_here
7070
// field_name: something or the other
7171
// some_map:
7272
// nested_fields: wowow
7373
// error:
7474
// - msg: wrap2
75-
// loc: /Users/nhooyr/src/cdr/slog/test_test.go:21
75+
// loc: /Users/nhooyr/src/cdr/slog/test_test.go:43
7676
// fun: go.coder.com/slog_test.TestExampleTest
7777
// - msg: wrap1
78-
// loc: /Users/nhooyr/src/cdr/slog/test_test.go:22
78+
// loc: /Users/nhooyr/src/cdr/slog/test_test.go:44
7979
// fun: go.coder.com/slog_test.TestExampleTest
8080
// - EOF
8181
// name: wow

fields.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ func parseFields(fields []Field) parsedFields {
3030

3131
for _, f := range fields {
3232
if s, ok := f.(componentField); ok {
33-
l.appendComponent(string(s))
33+
l = l.appendComponent(string(s))
3434
continue
3535
}
3636
l = l.appendField(f.LogKey(), f.LogValue())

0 commit comments

Comments
 (0)