Previously, we would collect the output with RUST_LOG=info, but only print it in case the invocation failed, thus swallowing any warnings. This PR introduces a log translator, that parses the output of genpolicy line by line and filters the output with regard to the currently configured log level. As a consequence, warnings are now shown by default, and when we configure debug logging in the Contrast CLI, the info logging of genpolicy is shown. However, in case genpolicy fails and the CLI debug level is info, we will now get slightly less output.
Example output (CLI loglevel info):
✔️ Patched targets
time=2024-06-26T08:03:50.284+02:00 level=WARN msg="Skipping symlink with long link name (NetLock_Arany_=Class_Gold=_Főtanúsítvány.pem, 48 bytes, NetLock_Arany_=Class_Gold=_Ftanstvny.pem, 40 bytes): etc/ssl/certs/988a38cb.0"
time=2024-06-26T08:03:50.284+02:00 level=WARN msg="Skipping symlink with long link name (/usr/share/ca-certificates/mozilla/NetLock_Arany_=Class_Gold=_Főtanúsítvány.crt, 83 bytes, /usr/share/ca-certificates/mozilla/NetLock_Arany_=Class_Gold=_Ftanstvny.crt, 75 bytes): etc/ssl/certs/NetLock_Arany_=Class_Gold=_Főtanúsítvány.pem"
time=2024-06-26T08:04:28.788+02:00 level=WARN msg="Failed to parse user as u32, using uid = 0 - error invalid digit found in string" position=genpolicy::registry
✔️ Generated workload policy annotations
✔️ Updated manifest workspace/manifest.json
Previously, we would collect the output with
RUST_LOG=info
, but only print it in case the invocation failed, thus swallowing any warnings. This PR introduces a log translator, that parses the output of genpolicy line by line and filters the output with regard to the currently configured log level. As a consequence, warnings are now shown by default, and when we configure debug logging in the Contrast CLI, the info logging of genpolicy is shown. However, in case genpolicy fails and the CLI debug level is info, we will now get slightly less output.Example output (CLI loglevel info):