Skip to content

Commit 8cf3fe1

Browse files
committed
added loggerMock
1 parent a2202e7 commit 8cf3fe1

File tree

3 files changed

+53
-1
lines changed

3 files changed

+53
-1
lines changed

go.mod

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,16 @@ module github.com/splitio/go-toolkit/v5
22

33
go 1.18
44

5-
require github.com/redis/go-redis/v9 v9.0.4
5+
require (
6+
github.com/redis/go-redis/v9 v9.0.4
7+
github.com/stretchr/testify v1.11.1
8+
)
69

710
require (
811
github.com/cespare/xxhash/v2 v2.2.0 // indirect
12+
github.com/davecgh/go-spew v1.1.1 // indirect
913
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect
14+
github.com/pmezard/go-difflib v1.0.0 // indirect
15+
github.com/stretchr/objx v0.5.2 // indirect
16+
gopkg.in/yaml.v3 v3.0.1 // indirect
1017
)

go.sum

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,19 @@ github.com/bsm/ginkgo/v2 v2.7.0 h1:ItPMPH90RbmZJt5GtkcNvIRuGEdwlBItdNVoyzaNQao=
22
github.com/bsm/gomega v1.26.0 h1:LhQm+AFcgV2M0WyKroMASzAzCAJVpAxQXv4SaI9a69Y=
33
github.com/cespare/xxhash/v2 v2.2.0 h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj44=
44
github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
5+
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
6+
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
57
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f h1:lO4WD4F/rVNCu3HqELle0jiPLLBs70cWOduZpkS1E78=
68
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f/go.mod h1:cuUVRXasLTGF7a8hSLbxyZXjz+1KgoB3wDUb6vlszIc=
9+
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
10+
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
711
github.com/redis/go-redis/v9 v9.0.4 h1:FC82T+CHJ/Q/PdyLW++GeCO+Ol59Y4T7R4jbgjvktgc=
812
github.com/redis/go-redis/v9 v9.0.4/go.mod h1:WqMKv5vnQbRuZstUwxQI195wHy+t4PuXDOjzMvcuQHk=
13+
github.com/stretchr/objx v0.5.2 h1:xuMeJ0Sdp5ZMRXx/aWO6RZxdr3beISkG5/G/aIRr3pY=
14+
github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA=
15+
github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U=
16+
github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U=
17+
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
18+
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
19+
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
20+
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=

logging/mocks/mocks.go

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
package mocks
22

3+
import (
4+
"github.com/splitio/go-toolkit/v5/logging"
5+
6+
"github.com/stretchr/testify/mock"
7+
)
8+
39
type MockLogger struct {
410
ErrorCall func(msg ...interface{})
511
WarningCall func(msg ...interface{})
@@ -27,3 +33,30 @@ func (l *MockLogger) Debug(msg ...interface{}) {
2733
func (l *MockLogger) Verbose(msg ...interface{}) {
2834
l.VerboseCall(msg...)
2935
}
36+
37+
type LoggerMock struct {
38+
mock.Mock
39+
}
40+
41+
func (l *LoggerMock) Debug(msg ...interface{}) {
42+
l.Called(msg)
43+
}
44+
45+
func (l *LoggerMock) Info(msg ...interface{}) {
46+
l.Called(msg)
47+
}
48+
49+
func (l *LoggerMock) Warning(msg ...interface{}) {
50+
l.Called(msg)
51+
}
52+
53+
func (l *LoggerMock) Error(msg ...interface{}) {
54+
l.Called(msg)
55+
}
56+
57+
func (l *LoggerMock) Verbose(msg ...interface{}) {
58+
l.Called(msg)
59+
}
60+
61+
var _ logging.LoggerInterface = (*LoggerMock)(nil)
62+
var _ logging.LoggerInterface = (*MockLogger)(nil)

0 commit comments

Comments
 (0)