Repository navigation
fix(logger): write $ALLOW_CONSOLE logs to stderr - #569
Open
NopeCharon wants to merge 1 commit into
Open
NopeCharon wants to merge 1 commit into
NopeCharon wants to merge 1 commit into
Conversation
Problem: With `$ALLOW_CONSOLE` set, the winston Console transport writes logs to stdout. When stdio is the RPC channel (e.g. remote plugins started by Nvim), the log lines are interpreted as invalid msgpack-RPC messages, which breaks the channel and kills the host. Running the integration tests with `ALLOW_CONSOLE=1` reproduces it: the remote plugin commands and functions are never registered. Solution: Route all log levels of the Console transport to stderr via `stderrLevels`. stderr is not part of the RPC channel (Nvim collects a job's stderr separately), so `$ALLOW_CONSOLE` is now safe to use with stdio RPC. Update the README accordingly and add a test that checks that nothing is written to stdout. Fixes neovim#343
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Problem:
With
$ALLOW_CONSOLEset, the winston Console transport writes logs tostdout. When stdio is the RPC channel (e.g. remote plugins started by
Nvim), the log lines are read as invalid msgpack-RPC messages, which
breaks the channel and kills the host. This reproduces with
ALLOW_CONSOLE=1 npm testinpackages/integration-tests: the remoteplugin commands/functions are never registered, so 3 tests fail
(
E492: Not an editor command: JSHostTestCmd,E117: Unknown function: Func).Solution:
stderrLevels. stderr is not part of the RPC channel (Nvim collects ajob's stderr separately), so
$ALLOW_CONSOLEis now safe with stdio RPC.ALLOW_CONSOLE=1and checks thatlogs (including the patched
console.log) go to stderr and nothing to stdout.With this change the integration tests also pass with
ALLOW_CONSOLE=1.Fixes #343