add ability to set log level via env var

This commit is contained in:
Asim Aslam 2019-08-08 13:07:04 +01:00
parent 11795071fb
commit fbc1d523d7

View File

@ -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...)