wonderivan / logger

golang日志处理包
109 stars 48 forks source link

不支持多日志文件输出 #7

Open TSZWind opened 4 years ago

TSZWind commented 4 years ago

log1 := logger.NewLogger() log2 := logger.NewLogger() log1.SetLogger("file", "{"filename":"log1.log"}") log2.SetLogger("file", "{"filename":"log2.log"}") log1.Info("log1") log2.Info("log2") 此时log1,log2都将输出到log2.log 原因是 var adapters = make(map[string]Logger) 调用Register时传入的是指针,SetLogger中logger, ok := adapters[adapterName],就会修改adapters 只会有一个file适配器生效