repository: use log hooks in tests
There are some tests that are not thread safe because it uses a bytes.Buffer
to test log messages.
For thread safety, use logger hooks that are part of the logrus library instead of using a buffer as the writer.
closes: #3933 (closed)
Edited by John Cai