From 51df4df118b49c8bf92451a978480a1cbe347687 Mon Sep 17 00:00:00 2001 From: Elad Tabak Date: Mon, 27 Apr 2020 16:30:49 +0300 Subject: [PATCH] Remove all prints --- injector.go | 30 +----------------------------- 1 file changed, 1 insertion(+), 29 deletions(-) diff --git a/injector.go b/injector.go index 58778da..efa8279 100644 --- a/injector.go +++ b/injector.go @@ -2,18 +2,8 @@ package injector import ( "fmt" - "os" "reflect" "strings" - "time" - - "github.com/sirupsen/logrus" -) - -const ( - // Default log format will output [INFO]: 2006-01-02T15:04:05Z07:00 - Log message - defaultLogFormat = "[%lvl%]: %time% - %msg%" - defaultTimestampFormat = time.RFC3339 ) type Injector interface { @@ -32,19 +22,6 @@ func NewEngine() *Engine { } } -var log *logrus.Logger - -func init() { - setupLogger() -} - -func setupLogger() { - logrus.SetFormatter(&logrus.TextFormatter{}) - logrus.SetOutput(os.Stdout) - logrus.SetLevel(logrus.InfoLevel) - log = logrus.StandardLogger() -} - func (inj *Engine) Register(beans ...interface{}) error { for _, bean := range beans { inj.beans = append(inj.beans, bean) @@ -54,7 +31,6 @@ func (inj *Engine) Register(beans ...interface{}) error { } structType := val.Type() typeFullName := inj.getTypeFullName(structType) - log.Debugf("type full name: %s\n", typeFullName) inj.typeToBean[typeFullName] = bean } return nil @@ -82,17 +58,14 @@ func (inj *Engine) injectBean(bean interface{}) error { for _, field := range fields { fieldName := field.Name fieldType := field.Type - log.Debugf("Name: %s, Type: %s\n", fieldName, fieldType) if fieldType == structType { - log.Infof("not supporting self injection") + // not supporting self injection continue } childName := inj.getContainingTypeFullName(field) - log.Debugf("chile name: %s\n", childName) child := inj.typeToBean[childName] if child == nil { if childName, ok := field.Tag.Lookup("inject"); ok { - log.Debugf("chile name: %s\n", childName) child = inj.typeToBean[childName] } } @@ -100,7 +73,6 @@ func (inj *Engine) injectBean(bean interface{}) error { f := val.FieldByName(fieldName) if f.CanAddr() && f.IsValid() { f.Set(reflect.ValueOf(child)) - log.Debugf("Injected %s", child) } } }