Allow initializing logger with additional tracing Layer

This commit is contained in:
Stypox
2025-05-12 16:27:09 +02:00
parent 2b0274c71d
commit 0d74252537
2 changed files with 26 additions and 3 deletions

View File

@@ -1507,6 +1507,17 @@ pub fn init_logger(early_dcx: &EarlyDiagCtxt, cfg: rustc_log::LoggerConfig) {
}
}
pub fn init_logger_with_additional_layer(
early_dcx: &EarlyDiagCtxt,
cfg: rustc_log::LoggerConfig,
additional_tracing_layer: impl rustc_log::Layer<rustc_log::Registry> + Send + Sync,
) {
if let Err(error) = rustc_log::init_logger_with_additional_layer(cfg, additional_tracing_layer)
{
early_dcx.early_fatal(error.to_string());
}
}
/// Install our usual `ctrlc` handler, which sets [`rustc_const_eval::CTRL_C_RECEIVED`].
/// Making this handler optional lets tools can install a different handler, if they wish.
pub fn install_ctrlc_handler() {