automaxprocs
automaxprocs copied to clipboard
The log format should be configurable or customizable
After import automaxprocs, the process will print "2019/07/09 14:18:22 maxprocs: Leaving GOMAXPROCS=2: CPU quota undefined" through STDOUT. There is no information to identify this line is an INFO, WARNING or ERROR log.
If the log format is configurable or customizable, the service using automaxprocs can generate the log message properly.
I agree
I would like to disable this log all together.
For the simple integration case (import _ "go.uber.org/automaxprocs"), it won't be possible to customize the behaviour as the
initfunction of
automaxprocs` would run before anything else could set the logger format, and it would require global configurations which will cause confusion if multiple packages try to set different values.
Instead, users who want customizations should use go.uber.org/automaxprocs/maxprocs
and call Set
with options. By default, maxprocs.Set
doesn't log anything. You can customize where the output goes, but it's not possible to control the format. It probably makes sense to add a hook with information about what changes Set
makes to allow users to log in any format.
I would like to disable this log all together.
You can use Set
above which won't log. We wanted to log by default, as setting a global like GOMAXPROCS
is a significant change which would be surprising if it was done silently because some package imported automaxprocs
.
The simple answer to this request is: use package go.uber.org/automaxprocs/maxprocs
instead of go.uber.org/automaxprocs
.
So the remaining issue is about documentation: go.uber.org/automaxprocs/maxprocs
is not mentioned in the package documentation for automaxprocs
.