From e1a75ac1c14cdd7c85a12be907437b331b4e430e Mon Sep 17 00:00:00 2001 From: Sebastien Bourdeauducq Date: Thu, 4 Jan 2018 22:19:46 +0800 Subject: [PATCH] runtime: set log level early We want to debug startup. --- artiq/firmware/runtime/main.rs | 37 +++++++++++++++++----------------- 1 file changed, 18 insertions(+), 19 deletions(-) diff --git a/artiq/firmware/runtime/main.rs b/artiq/firmware/runtime/main.rs index ad4863c03..a2645c028 100644 --- a/artiq/firmware/runtime/main.rs +++ b/artiq/firmware/runtime/main.rs @@ -54,6 +54,24 @@ fn startup() { info!("software version {}", include_str!(concat!(env!("OUT_DIR"), "/git-describe"))); info!("gateware version {}", board::ident::read(&mut [0; 64])); + match config::read_str("log_level", |r| r.map(|s| s.parse())) { + Ok(Ok(log_level_filter)) => { + info!("log level set to {} by `log_level` config key", + log_level_filter); + log::set_max_level(log_level_filter); + } + _ => info!("log level set to INFO by default") + } + match config::read_str("uart_log_level", |r| r.map(|s| s.parse())) { + Ok(Ok(uart_log_level_filter)) => { + info!("UART log level set to {} by `uart_log_level` config key", + uart_log_level_filter); + logger_artiq::BufferLogger::with(|logger| + logger.set_uart_log_level(uart_log_level_filter)); + } + _ => info!("UART log level set to INFO by default") + } + #[cfg(has_serwb_phy_amc)] board_artiq::serwb::wait_init(); @@ -162,25 +180,6 @@ fn startup_ethernet() { #[cfg(has_rtio_analyzer)] io.spawn(4096, analyzer::thread); - match config::read_str("log_level", |r| r.map(|s| s.parse())) { - Ok(Ok(log_level_filter)) => { - info!("log level set to {} by `log_level` config key", - log_level_filter); - log::set_max_level(log_level_filter); - } - _ => info!("log level set to INFO by default") - } - - match config::read_str("uart_log_level", |r| r.map(|s| s.parse())) { - Ok(Ok(uart_log_level_filter)) => { - info!("UART log level set to {} by `uart_log_level` config key", - uart_log_level_filter); - logger_artiq::BufferLogger::with(|logger| - logger.set_uart_log_level(uart_log_level_filter)); - } - _ => info!("UART log level set to INFO by default") - } - let mut net_stats = ethmac::EthernetStatistics::new(); loop { scheduler.run();