summaryrefslogtreecommitdiff
path: root/service/container.go
diff options
context:
space:
mode:
authorWolfy-J <[email protected]>2018-09-07 23:58:01 +0300
committerWolfy-J <[email protected]>2018-09-07 23:58:01 +0300
commitbf086da11191848ef3a74602d4c652034357e972 (patch)
tree3cfcac58a56af93ac21bfa982ffa5c1331a8356d /service/container.go
parent487d7c52ef2fc911606e756035a08292b3bd0128 (diff)
added support for logger in DI
Diffstat (limited to 'service/container.go')
-rw-r--r--service/container.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/service/container.go b/service/container.go
index c1d21c69..b6840375 100644
--- a/service/container.go
+++ b/service/container.go
@@ -251,6 +251,11 @@ func (c *container) resolveValues(s interface{}, m reflect.Method, cfg Config) (
case v.Implements(reflect.TypeOf((*Container)(nil)).Elem()): // container
values = append(values, reflect.ValueOf(c))
+ case v.Implements(reflect.TypeOf((*logrus.StdLogger)(nil)).Elem()),
+ v.Implements(reflect.TypeOf((*logrus.FieldLogger)(nil)).Elem()),
+ v.ConvertibleTo(reflect.ValueOf(c.log).Type()): // logger
+ values = append(values, reflect.ValueOf(c.log))
+
case v.Implements(reflect.TypeOf((*HydrateConfig)(nil)).Elem()): // injectable config
if cfg == nil {
return nil, errNoConfig