From d7aec2236e2ae15e71c6cd01317af2ce25369f6b Mon Sep 17 00:00:00 2001 From: Vasiliy Tolstov Date: Wed, 11 Mar 2020 20:55:39 +0300 Subject: [PATCH] minimize allocations in logger and tunnel code (#1323) * logs alloc Signed-off-by: Vasiliy Tolstov * fix allocs Signed-off-by: Vasiliy Tolstov * fix allocs Signed-off-by: Vasiliy Tolstov * tunnel allocs Signed-off-by: Vasiliy Tolstov * try to fix tunnel Signed-off-by: Vasiliy Tolstov * cache cipher for send Signed-off-by: Vasiliy Tolstov * more logger Signed-off-by: Vasiliy Tolstov * more logger Signed-off-by: Vasiliy Tolstov * more logger Signed-off-by: Vasiliy Tolstov * more logger Signed-off-by: Vasiliy Tolstov * more logger Signed-off-by: Vasiliy Tolstov * more logger Signed-off-by: Vasiliy Tolstov * more logger Signed-off-by: Vasiliy Tolstov --- cache.go | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/cache.go b/cache.go index 689c6e3..a68e32e 100644 --- a/cache.go +++ b/cache.go @@ -7,7 +7,7 @@ import ( "sync" "time" - log "github.com/micro/go-micro/v2/logger" + "github.com/micro/go-micro/v2/logger" "github.com/micro/go-micro/v2/registry" ) @@ -339,7 +339,9 @@ func (c *cache) run() { c.setStatus(err) if a > 3 { - log.Info("rcache: ", err, " backing off ", d) + if logger.V(logger.InfoLevel, logger.DefaultLogger) { + logger.Info("rcache: ", err, " backing off ", d) + } a = 0 } @@ -362,7 +364,9 @@ func (c *cache) run() { c.setStatus(err) if b > 3 { - log.Info("rcache: ", err, " backing off ", d) + if logger.V(logger.InfoLevel, logger.DefaultLogger) { + logger.Info("rcache: ", err, " backing off ", d) + } b = 0 }