-
Notifications
You must be signed in to change notification settings - Fork 242
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
Add new --level-prefix option #646
Conversation
db40f0b
to
a58b8b6
Compare
f71b028
to
ff6baae
Compare
Updated: while reviewing a similar change in libcapsule, @refi64 pointed out that I'd described the prefixes as "syslog-style" here, but not in libcapsule. In fact saying "syslog-style" is misleading, because https://datatracker.ietf.org/doc/html/rfc5424#section-6.2 describes a prefix that encodes both the severity and the facility, whereas here we're using only the severity, in order to be compatible with (Documentation updates only; the only code change is to rename a |
Any thoughts on this from other maintainers? My colleague @refi64 already provided some useful feedback, which I've addressed. |
I'm not a maintainer, but FWIW this looks good to me as well. |
This is the case since commit 0d369cd "main: Warn when non-repeatable options are repeated". Signed-off-by: Simon McVittie <[email protected]>
This takes a syslog-style severity level, allowing a larger program that runs bwrap and reads a pipe from its stderr to filter or highlight messages based on the severity. Take the opportunity to make the __debug__ macro (which normally expands to nothing, but can be enabled by changing a `#if 0` to `#if 1`) less weird and easier to use, by taking it out of the reserved-for-the-compiler namespace, adding a newline automatically, and not requiring nested parentheses. Signed-off-by: Simon McVittie <[email protected]>
This prepends a severity level such as <3> to each line of diagnostic output, with numeric severity levels taken from matching syslog(3) (such as LOG_ERR = 3), so that the diagnostic output can be parsed by tools like `logger --prio-prefix` and `systemd-cat --level-prefix=1` that support that encoding. The facility (LOG_USER, etc.) is not included, since it makes little sense to vary on a per-message basis. logger(1) supports prefixes with or without a facility, and systemd-cat(1) only supports prefixes without a facility, so this is compatible with both. A future version of Steam's pressure-vessel is likely to use this to make warnings and fatal errors from bubblewrap more visible. Signed-off-by: Simon McVittie <[email protected]>
ff6baae
to
89ae6b1
Compare
test-run: Assert that repeating --chdir logs a warning
This is the case since commit 0d369cd "main: Warn when
non-repeatable options are repeated".
utils: Put nearly all diagnostic output through a common log function
This takes a syslog-style severity level, allowing us to act based on
the severity.
Take the opportunity to make the
__debug__
macro (which normally expandsto nothing, but can be enabled by changing a
#if 0
to#if 1
) lessweird and easier to use, by taking it out of the reserved-for-the-compiler
namespace, adding a newline automatically, and not requiring nested
parentheses.
Add new --level-prefix option
This prepends a syslog-style priority level such as <3> to each line of
diagnostic output, so that the diagnostic output can be parsed by
tools like
systemd-cat --level-prefix=1
. A future version of Steam'spressure-vessel is likely to use this to make warnings and fatal errors
from bubblewrap more visible.
cc @refi64 @RyuzakiKK