@@ -12,3 +12,71 @@ slog is a minimal structured logging library for Go.
12
12
``` bash
13
13
go get go.coder.com/slog
14
14
```
15
+
16
+ ## Features
17
+
18
+ - Minimal API
19
+ - Tiny codebase
20
+ - First class [ context.Context] ( https://blog.golang.org/context ) support
21
+ - Beautiful logging output by default
22
+ - Multiple adapters
23
+ - First class [ \* testing.T] ( https://godoc.org/go.coder.com/slog/testlog ) support
24
+
25
+ ## Example
26
+
27
+ ```
28
+ testlog.Info(t, "my message here",
29
+ slog.F("field_name", "something or the other"),
30
+ slog.F("some_map", map[string]interface{}{
31
+ "nested_fields": "wowow",
32
+ }),
33
+ slog.F("some slice", []interface{}{
34
+ 1,
35
+ "foof",
36
+ "bar",
37
+ true,
38
+ }),
39
+ slog.Component("test"),
40
+
41
+ slog.F("name", slog.ValueFunc(func() interface{} {
42
+ return "wow"
43
+ })),
44
+ )
45
+
46
+ // --- PASS: TestExampleTest (0.00s)
47
+ // test_test.go:38: Sep 06 14:33:52.628 [INFO] (test): my_message_here
48
+ // field_name: something or the other
49
+ // some_map:
50
+ // nested_fields: wowow
51
+ // error:
52
+ // - msg: wrap2
53
+ // loc: /Users/nhooyr/src/cdr/slog/test_test.go:43
54
+ // fun: go.coder.com/slog_test.TestExampleTest
55
+ // - msg: wrap1
56
+ // loc: /Users/nhooyr/src/cdr/slog/test_test.go:44
57
+ // fun: go.coder.com/slog_test.TestExampleTest
58
+ // - EOF
59
+ // name: wow
60
+ ```
61
+
62
+ ## Design justifications
63
+
64
+ See [ #9 ] ( https://github.com/cdr/slog/issues/9 )
65
+
66
+ ## Comparison
67
+
68
+ ### zap
69
+
70
+ https://github.com/uber-go/zap
71
+
72
+ See [ #6 ] [ https://github.com/cdr/slog/issues/6 ]
73
+
74
+ ## Contributing
75
+
76
+ See [ .github/CONTRIBUTING.md] ( .github/CONTRIBUTING.md ) .
77
+
78
+ ## Users
79
+
80
+ If your company or project is using this library, feel free to open an issue or PR to amend this list.
81
+
82
+ - [ Coder] ( https://github.com/cdr )
0 commit comments