I have this function that logs an error in some cases:
func readByte(){
if err != nil {
fmt.Println("ERROR")
log.Print("Couldn't read first byte")
return
}
}
Now in the test file I want to check the output error from this function:
c.Assert(OUTPUT, check.Matches, "teste")
How can I access the magazine? I tried to put a buffer, but it did not work. What is the correct way to catch this log without changing my readByte function code?
Vivi source
share