We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
目前 Boomer 结构体的定义如下:
type Boomer struct { masterHost string masterPort int mode Mode rateLimiter RateLimiter slaveRunner *slaveRunner localRunner *localRunner spawnCount int spawnRate float64 cpuProfileFile string cpuProfileDuration time.Duration memoryProfileFile string memoryProfileDuration time.Duration outputs []Output logger *log.Logger }
其中 logger 字段是 golang 标准库的 Logger 结构体,这样用户只能传一个初始化 Logger 的变量作为 Boomer 的 log,如果改成 interface,定义类似于:
Logger interface { Debug(msg string, keyvals ...interface{}) Info(msg string, keyvals ...interface{}) Warn(msg string, keyvals ...interface{}) Error(msg string, keyvals ...interface{}) }
的方式,用户可以更灵活,代价更小地接入业务代码中实际需要的 log 呢,有可能是 zap.Logger 等等,如果用户不指定的话再传给一个默认的 Logger ,也许这个方案更灵活一些呢,目前很多的库都是类似的思路,例如 machinery,temporal 等
The text was updated successfully, but these errors were encountered:
确实,从设计上,这样更灵活。但是当时增加这个 logger,只是为了打印 boomer 内部的一些日志,一般情况下,都不需要日志打印。
Sorry, something went wrong.
No branches or pull requests
目前 Boomer 结构体的定义如下:
其中 logger 字段是 golang 标准库的 Logger 结构体,这样用户只能传一个初始化 Logger 的变量作为 Boomer 的 log,如果改成 interface,定义类似于:
的方式,用户可以更灵活,代价更小地接入业务代码中实际需要的 log 呢,有可能是 zap.Logger 等等,如果用户不指定的话再传给一个默认的 Logger ,也许这个方案更灵活一些呢,目前很多的库都是类似的思路,例如 machinery,temporal 等
The text was updated successfully, but these errors were encountered: