From 4b84db1b7d190ea193758593a22a38d00496167e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Victor=20Oliveira=20Couto?= Date: Sun, 26 May 2024 15:31:10 -0300 Subject: [PATCH] :wrench: feat: Update bindlogger example to print searched types --- examples/bindlogger/main.go | 3 ++- examples/bindlogger/utils/logger_injector.go | 10 +++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/examples/bindlogger/main.go b/examples/bindlogger/main.go index 7937638..27386a0 100644 --- a/examples/bindlogger/main.go +++ b/examples/bindlogger/main.go @@ -38,6 +38,7 @@ func main() { if len(phrase) >= 2^5 { fmt.Println(remy.Get[bool](lInject)) } - result := remy.Get[uint16](lInject) + + result := remy.Get[error](lInject) fmt.Println(result) } diff --git a/examples/bindlogger/utils/logger_injector.go b/examples/bindlogger/utils/logger_injector.go index 2fb17f4..40aceb3 100644 --- a/examples/bindlogger/utils/logger_injector.go +++ b/examples/bindlogger/utils/logger_injector.go @@ -17,7 +17,7 @@ func (c loggerInjector) Bind(key remy.BindKey, element any) (err error) { c.logger.Infof("Injector[Bind](%v, %v) - Starting\n", key, element) err = c.ij.Bind(key, element) if err != nil { - c.logger.Errorf("Injector[Bind] - Error: `%v`\n", err) + c.logger.Errorf("Injector[Bind]<%v> - Error: `%v`\n", key, err) } c.logger.Infof("Injector[Bind](%v, %v) - Ending\n", key, element) return @@ -27,7 +27,7 @@ func (c loggerInjector) BindNamed(key remy.BindKey, name string, element any) (e c.logger.Infof("Injector[Bind](%v, %s, %v) - Starting\n", key, name, element) err = c.ij.BindNamed(key, name, element) if err != nil { - c.logger.Errorf("Injector[BindNamed] - Error: `%v`\n", err) + c.logger.Errorf("Injector[BindNamed]<%v:%s> - Error: `%v`\n", key, name, err) } c.logger.Infof("Injector[Bind](%v, %s, %v) - Ending\n", key, name, element) return @@ -63,7 +63,7 @@ func (c loggerInjector) GetNamed(key remy.BindKey, name string) (result any, err c.logger.Infof("Injector[GetNamed](%v, %s) - Starting\n", key, name) result, err = c.ij.GetNamed(key, name) if err != nil { - c.logger.Errorf("Injector[GetNamed] - Error: `%v`\n", err) + c.logger.Errorf("Injector[GetNamed]<%v:%s> - Error: `%v`\n", key, name, err) } c.logger.Infof("Injector[GetNamed](%v, %s) - Found `%+v`\n", key, name, result) @@ -74,7 +74,7 @@ func (c loggerInjector) Get(key remy.BindKey) (result any, err error) { c.logger.Infof("Injector[Get](%v) - Starting\n", key) result, err = c.ij.Get(key) if err != nil { - c.logger.Errorf("Injector[Get] - Error: `%v`\n", err) + c.logger.Errorf("Injector[Get]<%v> - Error: `%v`\n", key, err) } c.logger.Infof("Injector[Get](%v) - Found `%+v`\n", key, result) @@ -85,7 +85,7 @@ func (c loggerInjector) GetAll(optKey ...string) (result []any, err error) { c.logger.Infof("Injector[GetAll](%+v) - Starting\n", optKey) result, err = c.ij.GetAll(optKey...) if err != nil { - c.logger.Errorf("Injector[GetAll] - Error: `%v`\n", err) + c.logger.Errorf("Injector[GetAll]<%v> - Error: `%v`\n", optKey, err) } c.logger.Infof("Injector[GetAll](%+v) - Found `%+v`\n", optKey, result)