Skip to content

Commit 5dacb2a

Browse files
authored
Merge pull request #7 from cdr/docs
Docs
2 parents 5fb81da + 1ed38bb commit 5dacb2a

File tree

3 files changed

+69
-3
lines changed

3 files changed

+69
-3
lines changed

README.md

Lines changed: 69 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,78 @@
55
[![Codecov](https://img.shields.io/codecov/c/github/cdr/slog.svg?color=success)](https://codecov.io/gh/cdr/slog)
66
[![CI](https://img.shields.io/circleci/build/github/cdr/slog?label=ci)](https://github.com/cdr/slog/commits/master)
77

8-
slog is a minimal and idiomatic structured logging library for Go.
8+
slog is a minimal structured logging library for Go.
99

1010
## Install
1111

1212
```bash
1313
go get go.coder.com/slog
1414
```
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)

ci/tools.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ package ci
66
import (
77
_ "go.coder.com/go-tools/cmd/goimports"
88
_ "golang.org/x/lint/golint"
9-
_ "golang.org/x/tools/cmd/stringer"
109
_ "gotest.tools/gotestsum"
1110
_ "mvdan.cc/sh/cmd/shfmt"
1211
)

go.mod

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ require (
1010
go.coder.com/go-tools v0.0.0-20190317003359-0c6a35b74a16
1111
go.opencensus.io v0.22.1
1212
golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3
13-
golang.org/x/tools v0.0.0-20190311212946-11955173bddd
1413
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7
1514
gotest.tools/gotestsum v0.3.5
1615
mvdan.cc/sh v2.6.4+incompatible

0 commit comments

Comments
 (0)