github.com/vanstinator/golangci-lint@v0.0.0-20240223191551-cc572f00d9d1/pkg/logutils/mock.go (about) 1 package logutils 2 3 import ( 4 "github.com/stretchr/testify/mock" 5 ) 6 7 type MockLog struct { 8 mock.Mock 9 } 10 11 func NewMockLog() *MockLog { 12 return &MockLog{} 13 } 14 15 func (m *MockLog) Fatalf(format string, args ...any) { 16 mArgs := []any{format} 17 m.Called(append(mArgs, args...)...) 18 } 19 20 func (m *MockLog) Panicf(format string, args ...any) { 21 mArgs := []any{format} 22 m.Called(append(mArgs, args...)...) 23 } 24 25 func (m *MockLog) Errorf(format string, args ...any) { 26 mArgs := []any{format} 27 m.Called(append(mArgs, args...)...) 28 } 29 30 func (m *MockLog) Warnf(format string, args ...any) { 31 mArgs := []any{format} 32 m.Called(append(mArgs, args...)...) 33 } 34 35 func (m *MockLog) Infof(format string, args ...any) { 36 mArgs := []any{format} 37 m.Called(append(mArgs, args...)...) 38 } 39 40 func (m *MockLog) Child(name string) Log { 41 m.Called(name) 42 return m 43 } 44 45 func (m *MockLog) SetLevel(level LogLevel) { 46 m.Called(level) 47 }