go-sql-driver / go-sql-driver/mysql

Logger interface compatible with testing package

Open
#593 4 comments 1 reaction 0 assignees View on GitHub
help wanted
Dominant language
Go
Stars
15.3k
Forks
2.3k
Avg merge
2h 23m
Merged PRs (30d)
10

Description

### Issue description
It would be convenient if the Logger interface was compatible with the testing logger (Logf).

### Example code
```go
func TestMyTest(t *testing.T) {
// start mysql in a test with a container for instance
// test polls mysql waiting for the connection to come up
// meanwhile go-sql-driver/mysql dumps errors into the testing package
someCodeSucceeds
// testing does not report log statements
}
```

### Error log
```
mysql dumps messages into the terminal regardless of testing success or failure
[mysql] 2017/05/16 15:46:20 packets.go:33: unexpected EOF
[mysql] 2017/05/16 15:46:20 packets.go:33: unexpected EOF
[mysql] 2017/05/16 15:46:20 packets.go:33: unexpected EOF
[mysql] 2017/05/16 15:46:21 packets.go:33: unexpected EOF
[mysql] 2017/05/16 15:46:21 packets.go:33: unexpected EOF
[mysql] 2017/05/16 15:46:21 packets.go:33: unexpected EOF
[mysql] 2017/05/16 15:46:22 packets.go:33: unexpected EOF
[mysql] 2017/05/16 15:46:22 packets.go:33: unexpected EOF
[mysql] 2017/05/16 15:46:22 packets.go:33: unexpected EOF
```

### Configuration
*Driver version (or git SHA):*
1.3.0
*Go version:* run `go version` in your console
1.8.1
*Server version:* E.g. MySQL 5.6, MariaDB 10.0.20
MySQL 5.6
*Server OS:* E.g. Debian 8.1 (Jessie), Windows 10
Oracle Linux 7

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.