Trevor Pounds a16b4d872b Use stretchr/testify to mock log.
Simplifies test log usage and removes additional
targets and dependencies to go:generate mocks.
2019-09-24 11:58:40 -04:00

48 lines
962 B
Go

package logutils
import (
"github.com/stretchr/testify/mock"
)
type MockLog struct {
mock.Mock
}
func NewMockLog() *MockLog {
return &MockLog{}
}
func (m *MockLog) Fatalf(format string, args ...interface{}) {
mArgs := []interface{}{format}
m.Called(append(mArgs, args...)...)
}
func (m *MockLog) Panicf(format string, args ...interface{}) {
mArgs := []interface{}{format}
m.Called(append(mArgs, args...)...)
}
func (m *MockLog) Errorf(format string, args ...interface{}) {
mArgs := []interface{}{format}
m.Called(append(mArgs, args...)...)
}
func (m *MockLog) Warnf(format string, args ...interface{}) {
mArgs := []interface{}{format}
m.Called(append(mArgs, args...)...)
}
func (m *MockLog) Infof(format string, args ...interface{}) {
mArgs := []interface{}{format}
m.Called(append(mArgs, args...)...)
}
func (m *MockLog) Child(name string) Log {
m.Called(name)
return m
}
func (m *MockLog) SetLevel(level LogLevel) {
m.Called(level)
}