https://github.com/gregoryv/testlog
Provides ways to redirect log output during testing
https://github.com/gregoryv/testlog
Last synced: 9 months ago
JSON representation
Provides ways to redirect log output during testing
- Host: GitHub
- URL: https://github.com/gregoryv/testlog
- Owner: gregoryv
- Created: 2021-01-21T14:15:36.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2022-07-25T09:46:20.000Z (almost 4 years ago)
- Last Synced: 2025-08-22T10:41:13.658Z (10 months ago)
- Language: Go
- Size: 4.88 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: changelog.md
Awesome Lists containing this project
README
Package testlog to catch logs while testing
## Quick start
$ go get github.com/gregoryv/testlog
in your code
```go
func TestYourthing(t *testing.T) {
buf := testlog.Catch(t)
// do something
got := buf.String()
exp := "some log phrase"
if !strings.Contains(got, exp) {
t.Error(got, " missing expected ", exp)
}
}
```