mirror of
				https://github.com/go-micro/go-micro.git
				synced 2025-10-30 23:27:41 +02:00 
			
		
		
		
	logger: fix reading env var (#1414)
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
		| @@ -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 | ||||
|   | ||||
| @@ -1,6 +1,8 @@ | ||||
| package logger | ||||
|  | ||||
| import "testing" | ||||
| import ( | ||||
| 	"testing" | ||||
| ) | ||||
|  | ||||
| func TestLogger(t *testing.T) { | ||||
| 	l := NewLogger(WithLevel(TraceLevel)) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user