-
Notifications
You must be signed in to change notification settings - Fork 1
/
logger_test.go
53 lines (41 loc) · 1.14 KB
/
logger_test.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
45
46
47
48
49
50
51
52
53
package log
import (
"github.com/echocat/slf4g/fields"
"github.com/echocat/slf4g/level"
)
func newMockLogger(name string) *mockLogger {
return &mockLogger{NewLogger(newMockCoreLogger(name)).(*loggerImpl)}
}
type mockLogger struct {
*loggerImpl
}
func (instance *mockLogger) setLevel(in level.Level) {
instance.coreProvider().(*mockCoreLogger).level = in
}
func (instance *mockLogger) getProvider() *mockProvider {
return instance.coreProvider().(*mockCoreLogger).provider
}
func (instance *mockLogger) getFieldKeysSpec() fields.KeysSpec {
return instance.GetProvider().GetFieldKeysSpec()
}
func (instance *mockLogger) initLoggedEvents() {
instance.coreProvider().(*mockCoreLogger).initLoggedEvents()
}
func (instance *mockLogger) loggedEvents() []Event {
if v := instance.coreProvider().(*mockCoreLogger).loggedEvents; v != nil {
return *v
}
return nil
}
func (instance *mockLogger) loggedEvent(i int) Event {
return instance.loggedEvents()[i]
}
func newWrappingLogger(in Logger) *wrappingLogger {
return &wrappingLogger{in}
}
type wrappingLogger struct {
Logger
}
func (instance *wrappingLogger) Unwrap() Logger {
return instance.Logger
}