21 lines
1.1 KiB
Markdown
21 lines
1.1 KiB
Markdown
|
|
# apex mocks
|
||
|
|
|
||
|
|
[](https://goreportcard.com/report/gitlab.com/unboundsoftware/apex-mocks) [](https://godoc.org/gitlab.com/unboundsoftware/apex-mocks) [](https://gitlab.com/unboundsoftware/apex-mocks/commits/master)[](https://gitlab.com/unboundsoftware/apex-mocks/commits/master)
|
||
|
|
|
||
|
|
Package `mocks` provides a mock implementation of [Apex](https://github.com/apex/logs) which can be used to unit test applications using Apex logging.
|
||
|
|
|
||
|
|
### Download
|
||
|
|
```shell
|
||
|
|
go get gitlab.com/unboundsoftware/apex-mocks
|
||
|
|
```
|
||
|
|
|
||
|
|
### Usage
|
||
|
|
Make sure that your application uses `log.Interface` to be able to pass in a `Mock` from your tests instead.
|
||
|
|
|
||
|
|
To verify what has been logged:
|
||
|
|
```go
|
||
|
|
logger := &apex.Mock{}
|
||
|
|
// ... run your actual test using the logger above
|
||
|
|
logger.Check(t, tt.wantLogged)
|
||
|
|
```
|