Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
TSZWind opened this issue Oct 26, 2020 · 0 comments
Open

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

TSZWind opened this issue Oct 26, 2020 · 0 comments

Comments

@TSZWind
Copy link

TSZWind commented Oct 26, 2020

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适配器生效

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant