-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
libherokubuildpack: Fix colour resetting for the log_*
macros
#890
Merged
Conversation
This file contains 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
This fixes some long-standing ANSI colour bugs with the `log_header`, `log_error` and `log_warning` macros. Whilst we soon want to move away to more advanced logging libraries that use the new logging style, there are still many buildpacks using these macros which will benefit short term from these fixes (Procfile, Go, Node.js, JVM, Python, PHP, buildpacks-release-phase, buildpacks-frontend-web). The logging macros would previously emit output roughly like: ``` <colour> [Error: Foo] <reset><colour>Message line one. Message line two. ``` This was not only missing the final `<reset>`, but also didn't wrap each line individually with colour codes/resets. This causes issues when lines end up prefixed - such as the Git `remote:` prefix, or when using Pack CLI locally with an untrusted build (which adds the colourised `[builder]` prefixes) or `--timestamps` mode. For example in this: ``` remote: <colour> remote: [Error: Foo] remote: <reset><colour>Message line one. remote: Message line two. ``` ...several of the `remote:`s would inherit the colours. Instead what we need is: ``` remote: remote: <colour>[Error: Foo]<reset> remote: <colour>Message line one.<reset> remote: <colour>Message line two.<reset> ``` Fixes #555. Closes #844. GUS-W-17400078.
edmorley
force-pushed
the
edmorley/fix-log-styling
branch
from
December 10, 2024 00:11
4367854
to
d33fe4e
Compare
Malax
reviewed
Dec 10, 2024
Malax
approved these changes
Dec 10, 2024
heroku-linguist bot
added a commit
to heroku/buildpacks-python
that referenced
this pull request
Dec 13, 2024
## heroku/python ### Fixed - Fixed colour resetting for build output header, error and warning messages. ([#303](#303) / [heroku/libcnb.rs#890](heroku/libcnb.rs#890))
heroku-linguist bot
added a commit
to heroku/buildpacks-python
that referenced
this pull request
Dec 13, 2024
## heroku/python ### Fixed - Fixed colour resetting for build output header, error and warning messages. ([#303](#303) / [heroku/libcnb.rs#890](heroku/libcnb.rs#890)) Co-authored-by: heroku-linguist[bot] <136119646+heroku-linguist[bot]@users.noreply.github.com>
heroku-linguist bot
added a commit
to heroku/cnb-builder-images
that referenced
this pull request
Dec 13, 2024
## heroku/python ### Fixed - Fixed colour resetting for build output header, error and warning messages. ([#303](heroku/buildpacks-python#303) / [heroku/libcnb.rs#890](heroku/libcnb.rs#890))
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 fixes some long-standing ANSI colour bugs with the
log_header
,log_error
andlog_warning
macros.Whilst we soon want to move away to more advanced logging libraries that use the new logging style, there are still many buildpacks using these macros which will benefit short term from these fixes (Procfile, Go, Node.js, JVM, Python, PHP, buildpacks-release-phase, buildpacks-frontend-web).
The logging macros would previously emit output roughly like:
This was not only missing the final
<reset>
, but also didn't wrap each line individually with colour codes/resets.This causes issues when lines end up prefixed - such as the Git
remote:
prefix, or when using Pack CLI locally with an untrusted build (which adds the colourised[builder]
prefixes) or--timestamps
mode.For example in this:
...several of the
remote:
s would inherit the colours.Instead what we need is:
Fixes #555.
Closes #844.
GUS-W-17400078.