feat: Print FatalError messages using Logger (#2292)

* feat: Print FatalError messages using Logger

This makes them appear GHA annotations in CI logs, which makes them easier to spot. I've also added the "cibuildwheel: " prefix to those errors, I think it helps when viewing a log to know which tool is talking to you - it can be difficult to understand with build tools.

* Nicer error message on invalid architecture

* Fix some message formatting and test expectations
This commit is contained in:
Joe Rickerby
2025-03-01 10:47:44 +01:00
committed by GitHub
parent 708cf1d32b
commit 9e72cd9b54
6 changed files with 28 additions and 23 deletions
+6 -6
View File
@@ -159,24 +159,24 @@ class Logger:
def notice(self, message: str) -> None:
if self.fold_mode == "github":
print(f"::notice::{message}\n", file=sys.stderr)
print(f"::notice::cibuildwheel: {message}\n", file=sys.stderr)
else:
c = self.colors
print(f"{c.bold}Note{c.end}: {message}\n", file=sys.stderr)
print(f"cibuildwheel: {c.bold}note{c.end}: {message}\n", file=sys.stderr)
def warning(self, message: str) -> None:
if self.fold_mode == "github":
print(f"::warning::{message}\n", file=sys.stderr)
print(f"::warning::cibuildwheel: {message}\n", file=sys.stderr)
else:
c = self.colors
print(f"{c.yellow}Warning{c.end}: {message}\n", file=sys.stderr)
print(f"cibuildwheel: {c.yellow}warning{c.end}: {message}\n", file=sys.stderr)
def error(self, error: BaseException | str) -> None:
if self.fold_mode == "github":
print(f"::error::{error}\n", file=sys.stderr)
print(f"::error::cibuildwheel: {error}\n", file=sys.stderr)
else:
c = self.colors
print(f"{c.bright_red}Error{c.end}: {error}\n", file=sys.stderr)
print(f"cibuildwheel: {c.bright_red}error{c.end}: {error}\n", file=sys.stderr)
@property
def step_active(self) -> bool: