We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent b3b059a commit d8657eaCopy full SHA for d8657ea
internal/mocks/logger.go
@@ -0,0 +1,44 @@
1
+package mocks
2
+
3
+import (
4
+ "io"
5
+ "log"
6
+)
7
8
+type MockLogger struct {
9
+ l *log.Logger
10
+ debugLevel bool
11
+}
12
13
+func NewMockLogger() *MockLogger {
14
+ return &MockLogger{
15
+ l: log.Default(),
16
+ }
17
18
19
+func (m *MockLogger) SetDebugLevel(dl bool) {
20
+ m.debugLevel = dl
21
22
23
+func (m *MockLogger) SetWriter(w io.Writer) {
24
+ m.l.SetOutput(w)
25
26
27
+func (m *MockLogger) Error(v ...any) {
28
+ m.l.Println("[ERROR]", v)
29
30
31
+func (m *MockLogger) Info(v ...any) {
32
+ m.l.Println("[INFO]", v)
33
34
35
+func (m *MockLogger) Debug(v ...any) {
36
+ if m.debugLevel {
37
+ m.l.Println("[DEBUG]", v)
38
39
40
41
+func (m *MockLogger) Panic(v ...any) {
42
+ m.l.Println("[PANIC]", v)
43
44
0 commit comments