1
0
mirror of https://github.com/go-micro/go-micro.git synced 2025-08-04 21:42:57 +02:00

logger: fix reading env var (#1414)

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
Vasiliy Tolstov
2020-03-26 01:00:43 +03:00
committed by GitHub
parent 6efc5556e5
commit beaa434610
2 changed files with 12 additions and 1 deletions

View File

@ -11,6 +11,15 @@ import (
dlog "github.com/micro/go-micro/v2/debug/log"
)
func init() {
lvl, err := GetLevel(os.Getenv("MICRO_LOG_LEVEL"))
if err != nil {
lvl = InfoLevel
}
DefaultLogger = NewHelper(NewLogger(WithLevel(lvl)))
}
type defaultLogger struct {
sync.RWMutex
opts Options

View File

@ -1,6 +1,8 @@
package logger
import "testing"
import (
"testing"
)
func TestLogger(t *testing.T) {
l := NewLogger(WithLevel(TraceLevel))