From fbc1d523d76f96e2cecb943117a216a4ea20c79e Mon Sep 17 00:00:00 2001 From: Asim Aslam Date: Thu, 8 Aug 2019 13:07:04 +0100 Subject: [PATCH] add ability to set log level via env var --- util/log/log.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/util/log/log.go b/util/log/log.go index f7ad8324..4374aa1b 100644 --- a/util/log/log.go +++ b/util/log/log.go @@ -26,6 +26,19 @@ var ( level = info ) +func init() { + switch os.Getenv("MICRO_LOG_LEVEL") { + case "debug": + level = debug + case "info": + level = info + case "trace": + level = trace + case "fatal": + level = fatal + } +} + // Log makes use of github.com/go-log/log.Log func Log(v ...interface{}) { logger.Log(v...)