7
7
8
8
"github.com/pubgo/funk/assert"
9
9
"github.com/pubgo/funk/errors"
10
- "github.com/pubgo/funk/log"
11
10
"github.com/pubgo/funk/recovery"
12
11
"github.com/pubgo/funk/stack"
13
12
)
@@ -58,7 +57,7 @@ func (x *Dix) evalProvider(typ outputType, opt Options) map[group][]value {
58
57
}
59
58
60
59
if len (x .providers [typ ]) == 0 {
61
- log .Warn ().
60
+ logger .Warn ().
62
61
Str ("type" , typ .String ()).
63
62
Str ("kind" , typ .Kind ().String ()).
64
63
Msg ("provider not found, please check whether the provider imports or type error" )
@@ -69,7 +68,7 @@ func (x *Dix) evalProvider(typ outputType, opt Options) map[group][]value {
69
68
x .objects [typ ] = make (map [group ][]value )
70
69
}
71
70
72
- log .Debug ().
71
+ logger .Debug ().
73
72
Str ("type" , typ .String ()).
74
73
Str ("kind" , typ .Kind ().String ()).
75
74
Int ("providers" , len (x .providers [typ ])).
@@ -92,7 +91,7 @@ func (x *Dix) evalProvider(typ outputType, opt Options) map[group][]value {
92
91
for k , oo := range handleOutput (typ , fnCall [0 ]) {
93
92
if n .output .isMap {
94
93
if _ , ok := objects [k ]; ok {
95
- log .Info ().
94
+ logger .Info ().
96
95
Str ("type" , typ .String ()).
97
96
Str ("key" , k .String ()).
98
97
Msg ("type value exists" )
@@ -135,7 +134,7 @@ func (x *Dix) getValue(typ reflect.Type, opt Options, isMap, isList bool) reflec
135
134
case isMap :
136
135
valMap := x .evalProvider (typ , opt )
137
136
if ! opt .AllowValuesNull && len (valMap ) == 0 {
138
- log .Panic ().
137
+ logger .Panic ().
139
138
Any ("options" , opt ).
140
139
Str ("type" , typ .String ()).
141
140
Any ("providers" , x .getProviderStack (typ )).
@@ -152,7 +151,7 @@ func (x *Dix) getValue(typ reflect.Type, opt Options, isMap, isList bool) reflec
152
151
Detail : fmt .Sprintf ("type=%s kind=%s allValues=%v" , typ , typ .Kind (), valMap ),
153
152
}
154
153
155
- log .Panic ().Err (err ).
154
+ logger .Panic ().Err (err ).
156
155
Any ("options" , opt ).
157
156
Any ("values" , valMap [defaultKey ]).
158
157
Any ("providers" , x .getProviderStack (typ )).
@@ -169,7 +168,7 @@ func (x *Dix) getValue(typ reflect.Type, opt Options, isMap, isList bool) reflec
169
168
default :
170
169
valMap := x .evalProvider (typ , opt )
171
170
if valList , ok := valMap [defaultKey ]; ! ok || len (valList ) == 0 {
172
- log .Panic ().
171
+ logger .Panic ().
173
172
Any ("options" , opt ).
174
173
Any ("values" , valMap [defaultKey ]).
175
174
Str ("type" , typ .String ()).
@@ -185,7 +184,7 @@ func (x *Dix) getValue(typ reflect.Type, opt Options, isMap, isList bool) reflec
185
184
Detail : fmt .Sprintf ("type=%s kind=%s value=%v" , typ , typ .Kind (), val .Interface ()),
186
185
}
187
186
188
- log .Panic ().Err (err ).
187
+ logger .Panic ().Err (err ).
189
188
Any ("options" , opt ).
190
189
Any ("values" , valList ).
191
190
Any ("providers" , x .getProviderStack (typ )).
@@ -328,7 +327,7 @@ func (x *Dix) handleProvide(fnVal reflect.Value, out reflect.Type, in []*inType)
328
327
n .output = & outType {typ : outTyp }
329
328
x .providers [n .output .typ ] = append (x .providers [n .output .typ ], n )
330
329
case reflect .Struct :
331
- log .Debug ().Str ("name" , outTyp .Name ()).Msg ("struct info" )
330
+ logger .Debug ().Str ("name" , outTyp .Name ()).Msg ("struct info" )
332
331
for i := 0 ; i < outTyp .NumField (); i ++ {
333
332
x .handleProvide (fnVal , outTyp .Field (i ).Type , in )
334
333
}
@@ -419,6 +418,6 @@ func (x *Dix) provide(param interface{}) {
419
418
420
419
dep , ok := x .isCycle ()
421
420
if ok {
422
- log .Fatal ().Str ("cycle" , dep ).Msg ("provider circular dependency" )
421
+ logger .Fatal ().Str ("cycle" , dep ).Msg ("provider circular dependency" )
423
422
}
424
423
}
0 commit comments