Do not override the default log output in the server #160
+80
−7
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
In order to transition large existing codebases to use end-to-end structured logging, we want to be able to make use of the hclog
Logger.StandardWriter
. The entails setting the default std library log output to a wrapped instance of anhclog.Logger
while running the server.The
plugin.Server
function however overrides the log output when initializing the server. This means the implementation currently needs to restore its logger again after the server has started (there is no callback, so this must be checked on the first method call). Failing to do so does not cause an error, however it does cause the log output to lose its structure.Removing the call to
log.SetOutput
makes it easier to setup a std library logger for all implementations, at the minor expense of requiring all implementations to ensure they write toos.Stderr
, which is almost always the default case.Fixes #155