logger: fix reading env var (#1414)
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
parent
6efc5556e5
commit
beaa434610
@ -11,6 +11,15 @@ import (
|
|||||||
dlog "github.com/micro/go-micro/v2/debug/log"
|
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 {
|
type defaultLogger struct {
|
||||||
sync.RWMutex
|
sync.RWMutex
|
||||||
opts Options
|
opts Options
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
package logger
|
package logger
|
||||||
|
|
||||||
import "testing"
|
import (
|
||||||
|
"testing"
|
||||||
|
)
|
||||||
|
|
||||||
func TestLogger(t *testing.T) {
|
func TestLogger(t *testing.T) {
|
||||||
l := NewLogger(WithLevel(TraceLevel))
|
l := NewLogger(WithLevel(TraceLevel))
|
||||||
|
Loading…
Reference in New Issue
Block a user