Edk2 logging
edk2_logging ¶
Handles basic logging config for invocables.
edk2_logging will automatically filter logs for PATs / Secrets when it is detected that the invocable is running on a CI system. It does this via searching for "CI" or "TF_BUILD" in the os's environment variables. If either of these exists and and are set to TRUE, filtering will occur.
Splits logs into a master log and per package log.
Edk2LogFilter ¶
Subclass of logging.Filter.
filter ¶
filter(record: logging.LogRecord) -> bool
Adds a filter for a record if it doesn't already exist.
clean_build_logs ¶
clean_build_logs(
ws: str, sub_directory: Optional[str] = None
) -> None
Removes all build logs.
log_progress ¶
log_progress(message: str) -> None
Creates a logging message at the progress section level.
setup_txt_logger ¶
setup_txt_logger(
directory: str,
filename: str = "log",
logging_level: int = logging.INFO,
formatter: Optional[logging.Formatter] = None,
logging_namespace: Optional[str] = "",
isVerbose: bool = False,
) -> tuple
Configures a text logger.
setup_console_logging ¶
setup_console_logging(
logging_level: int = logging.INFO,
formatter: Optional[logging.Formatter] = None,
logging_namespace: Optional[str] = "",
isVerbose: bool = False,
use_azure_colors: bool = False,
use_color: bool = True,
) -> logging.Handler
Configures a console logger.
Filtering of secrets will automatically occur if "CI" or "TF_BUILD" is set to TRUE in the os's environment.
stop_logging ¶
stop_logging(
loghandle: Union[
list[logging.Handler], logging.Handler
],
logging_namespace: Optional[str] = "",
) -> None
Stops logging on a log handle.
create_output_stream ¶
create_output_stream(
level: int = logging.INFO,
logging_namespace: Optional[str] = "",
) -> logging.Handler
Creates an output stream to log to.
remove_output_stream ¶
remove_output_stream(
handler: logging.Handler,
logging_namespace: Optional[str] = "",
) -> None
Removes an output stream to log to.
scan_compiler_output ¶
scan_compiler_output(output_stream: TextIO) -> list[tuple]
Scans the compiler for errors and warnings.
Returns:
Type | Description |
---|---|
list[tuple[Type, str]]
|
list of tuples containing the type of issue (Error, warning) and the description. |