diff --git a/annotation/definition.go b/annotation/definition.go index c53a0a6..5718412 100644 --- a/annotation/definition.go +++ b/annotation/definition.go @@ -1,8 +1,11 @@ package annotation import ( + "fmt" "reflect" + "git.loafle.net/commons_go/logging" + cdur "git.loafle.net/commons_go/di/util/reflect" ) @@ -13,6 +16,10 @@ func init() { } func RegisterAnnotation(name string, t reflect.Type) { + if _, ok := annotationRegistry[name]; ok { + logging.Logger().Panic(fmt.Sprintf("DI: name[%s] of annotation exist already.", name)) + } + meta := getMetaFields(t) fRT, _, _ := cdur.GetTypeInfo(t) diff --git a/registry/registry.go b/registry/registry.go index 2dbbba7..23ded48 100644 --- a/registry/registry.go +++ b/registry/registry.go @@ -2,7 +2,6 @@ package registry import ( "fmt" - "log" "reflect" "runtime" "strings" @@ -50,7 +49,7 @@ func RegisterType(t reflect.Type) { pc, _, _, ok := runtime.Caller(1) details := runtime.FuncForPC(pc) if ok && details != nil { - log.Printf("called from %s\n", details.Name()) + logging.Logger().Debug(fmt.Sprintf("called from %s", details.Name())) } registry.RegisterType(t)