forked from hmdsefi/channelize
/
logger.go
44 lines (34 loc) · 901 Bytes
/
logger.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
/**
* Copyright © 2022 Hamed Yousefi <hdyousefi@gmail.com>.
*/
package mock
import (
"testing"
"github.com/krismp/channelize/pkg/common/log"
"github.com/stretchr/testify/assert"
)
type Logger struct {
t *testing.T
expected []interface{}
}
func NewLogger(t *testing.T) *Logger {
return &Logger{t: t}
}
func (l *Logger) Expected(expected ...interface{}) {
l.expected = expected
}
func (l Logger) Info(msg string, keyValues ...interface{}) {
}
func (l Logger) Error(msg string, keyValues ...interface{}) {
actualArgs := append([]interface{}{log.Error, msg}, keyValues...)
if len(l.expected) != len(actualArgs) {
l.t.Fatal("not enough expected argument")
}
for i, expected := range l.expected {
assert.Equal(l.t, expected, actualArgs[i])
}
}
func (l Logger) Warn(msg string, keyValues ...interface{}) {
}
func (l Logger) Debug(msg string, keyValues ...interface{}) {
}