[VOL-1553] Improve device graph performance
This update focussed on generating routes using the device graph.
It improves the performance by at least 5 times.
Change-Id: I79bdbca8ea3d134e87848e45140d07ee3831f12c
diff --git a/common/log/log.go b/common/log/log.go
index 408158a..16fed74 100644
--- a/common/log/log.go
+++ b/common/log/log.go
@@ -359,11 +359,17 @@
}
//GetPackageLogLevel returns the current log level of a package.
-func GetPackageLogLevel(packageName string) (int, error) {
- if cfg, ok := cfgs[packageName]; ok {
+func GetPackageLogLevel(packageName ...string) (int, error) {
+ var name string
+ if len(packageName) == 1 {
+ name = packageName[0]
+ } else {
+ name, _, _, _ = getCallerInfo()
+ }
+ if cfg, ok := cfgs[name]; ok {
return levelToInt(cfg.Level.Level()), nil
}
- return 0, errors.New(fmt.Sprintf("unknown-package-%s", packageName))
+ return 0, errors.New(fmt.Sprintf("unknown-package-%s", name))
}
//SetLogLevel sets the log level for the logger corresponding to the caller's package