Disable coloring in build output when --console=plain is used#3087
Conversation
This comment has been minimized.
This comment has been minimized.
Codecov Report
@@ Coverage Diff @@
## master #3087 +/- ##
============================================
+ Coverage 71.09% 71.15% +0.06%
- Complexity 2307 2316 +9
============================================
Files 278 278
Lines 9755 9790 +35
Branches 989 991 +2
============================================
+ Hits 6935 6966 +31
+ Misses 2480 2478 -2
- Partials 340 346 +6 Continue to review full report at Codecov.
|
|
@mpeddada1 Can u pls review this? |
|
@vinod-tahelyani please follow the instructions above to sign the CLA so that we can accept your contribution. |
|
@googlebot I signed it! |
This comment has been minimized.
This comment has been minimized.
1 similar comment
This comment has been minimized.
This comment has been minimized.
|
@googlebot I fixed it. |
This comment has been minimized.
This comment has been minimized.
455b68a to
43770e3
Compare
This comment has been minimized.
This comment has been minimized.
43770e3 to
82fd82a
Compare
This comment has been minimized.
This comment has been minimized.
82fd82a to
c835d3c
Compare
|
@vinod-tahelyani, thanks for creating the PR! The change looks good. Can you add a test for it in |
|
@mpeddada1 we are expected to remove |
mpeddada1
left a comment
There was a problem hiding this comment.
@vinod-tahelyani Just added a few comments:)
@mpeddada1 we are expected to remove
\u001B[31;1mkind as well right, in PlainConsoleLogger?
does this remove bright colors?
.../src/test/java/com/google/cloud/tools/jib/plugins/common/logging/PlainConsoleLoggerTest.java
Outdated
Show resolved
Hide resolved
.../src/test/java/com/google/cloud/tools/jib/plugins/common/logging/PlainConsoleLoggerTest.java
Outdated
Show resolved
Hide resolved
|
|
||
| singleThreadedExecutor.execute(() -> messageConsumer.accept(message)); | ||
| // remove the color from the message | ||
| final String plainMessage = message.replaceAll("\u001B\\[[0-9;]{1,5}m", ""); |
There was a problem hiding this comment.
I think this is too lenient and actually more confusing. For example, [0-9;]{1,5} accepts a string like ;;8;3;. I think there can only be one ;.
There was a problem hiding this comment.
Oh, actually, it turns out there can be multiple semi-colons.
Several attributes can be set in the same sequence, separated by semicolons.
Therefore, \u001B\\[[0-9;]*m is more accurate. However, I am fine limiting the scope by finding up to 5 characters.
the intention is to remove a combination of (color + bold). example It will remove |
…Colors for plain logging
.../src/test/java/com/google/cloud/tools/jib/plugins/common/logging/PlainConsoleLoggerTest.java
Outdated
Show resolved
Hide resolved
mpeddada1
left a comment
There was a problem hiding this comment.
LGTM, thank you for your contribution!
Fixes #2764