Truncate colors if not supported#279
Open
tswaters wants to merge 3 commits intoLogRocket:masterfrom
Open
Conversation
Codecov Report
@@ Coverage Diff @@
## master #279 +/- ##
=========================================
Coverage ? 78.88%
=========================================
Files ? 6
Lines ? 180
Branches ? 0
=========================================
Hits ? 142
Misses ? 38
Partials ? 0
Continue to review full report at Codecov.
|
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.
This is a rehash of #203 but with different logic - 203 won't work any more due to some assumptions that the log methods were only called with max 2 parameters. This uses a lot of the same browser detection logic, with the addition of node - but has a totally different method.
In short:
figure out browser support ahead of time. I've got node as not supporting colors (it does, but one would need to use ansi escape sequences which aren't really compatible with html color codes)
proxy each of the used
consolemethods and pass arguments totruncateColorArguments-if colors are supported, return arguments unchanged,
if colors aren't supported, look for any
%cin string arguments and if found remove the number of %c found in the string from subsequent arguments - this removes the formatting information from the log.Also, fixed the CI build... it seems that someone left backticks in
./src/core.jsand eslint was complaining.