diff --git a/artiq/firmware/liblogger_artiq/lib.rs b/artiq/firmware/liblogger_artiq/lib.rs index 19c747c1b..dda2e482d 100644 --- a/artiq/firmware/liblogger_artiq/lib.rs +++ b/artiq/firmware/liblogger_artiq/lib.rs @@ -13,9 +13,9 @@ use log_buffer::LogBuffer; use board::{Console, clock}; pub struct BufferLogger { - buffer: RefCell>, - filter: RefCell>, - trace_to_uart: Cell + buffer: RefCell>, + filter: RefCell>, + concise_uart: Cell } static mut LOGGER: *const BufferLogger = 0 as *const _; @@ -25,7 +25,7 @@ impl BufferLogger { BufferLogger { buffer: RefCell::new(LogBuffer::new(buffer)), filter: RefCell::new(None), - trace_to_uart: Cell::new(true) + concise_uart: Cell::new(true) } } @@ -68,11 +68,11 @@ impl BufferLogger { .set(max_level) } - pub fn disable_trace_to_uart(&self) { - if self.trace_to_uart.get() { + pub fn enable_concise_uart(&self) { + if self.concise_uart.get() { trace!("disabling tracing to UART; all further trace messages \ are sent to core log only"); - self.trace_to_uart.set(false) + self.concise_uart.set(false) } } } @@ -103,7 +103,7 @@ impl Log for BufferLogger { // Printing to UART is really slow, so avoid doing that when we have an alternative // route to retrieve the debug messages. - if self.trace_to_uart.get() || record.level() <= LogLevel::Info || force_uart { + if self.concise_uart.get() || record.level() <= LogLevel::Info || force_uart { writeln!(Console, "[{:12}us] {:>5}({}): {}", clock::get_us(), record.level(), record.target(), record.args()).unwrap(); diff --git a/artiq/firmware/libproto/rpc_proto.rs b/artiq/firmware/libproto/rpc_proto.rs index a7424a905..cf5012031 100644 --- a/artiq/firmware/libproto/rpc_proto.rs +++ b/artiq/firmware/libproto/rpc_proto.rs @@ -75,7 +75,7 @@ pub fn recv_return(reader: &mut Read, tag_bytes: &[u8], data: *mut (), alloc: &Fn(usize) -> io::Result<*mut ()>) -> io::Result<()> { let mut it = TagIterator::new(tag_bytes); #[cfg(feature = "log")] - trace!("recv ...->{}", it); + debug!("recv ...->{}", it); let tag = it.next().expect("truncated tag"); let mut data = data; @@ -163,7 +163,7 @@ pub fn send_args(writer: &mut Write, service: u32, tag_bytes: &[u8], #[cfg(feature = "log")] { let return_it = TagIterator::new(return_tag_bytes); - trace!("send<{}>({})->{}", service, args_it, return_it); + debug!("send<{}>({})->{}", service, args_it, return_it); } writer.write_u32(service)?; diff --git a/artiq/firmware/runtime/analyzer.rs b/artiq/firmware/runtime/analyzer.rs index 8609a30f9..1e2909a37 100644 --- a/artiq/firmware/runtime/analyzer.rs +++ b/artiq/firmware/runtime/analyzer.rs @@ -54,7 +54,7 @@ fn worker(stream: &mut TcpStream) -> io::Result<()> { log_channel: csr::CONFIG_RTIO_LOG_CHANNEL as u8, dds_onehot_sel: true // kept for backward compatibility of analyzer dumps }; - trace!("{:?}", header); + debug!("{:?}", header); header.write_to(stream)?; if wraparound { diff --git a/artiq/firmware/runtime/session.rs b/artiq/firmware/runtime/session.rs index 8e5af82ee..f46ea6ed1 100644 --- a/artiq/firmware/runtime/session.rs +++ b/artiq/firmware/runtime/session.rs @@ -115,21 +115,21 @@ fn check_magic(stream: &mut TcpStream) -> io::Result<()> { fn host_read(stream: &mut TcpStream) -> io::Result { let request = host::Request::read_from(stream)?; match &request { - &host::Request::LoadKernel(_) => trace!("comm<-host LoadLibrary(...)"), - _ => trace!("comm<-host {:?}", request) + &host::Request::LoadKernel(_) => debug!("comm<-host LoadLibrary(...)"), + _ => debug!("comm<-host {:?}", request) } Ok(request) } fn host_write(stream: &mut Write, reply: host::Reply) -> io::Result<()> { - trace!("comm->host {:?}", reply); + debug!("comm->host {:?}", reply); reply.write_to(stream) } fn kern_send(io: &Io, request: &kern::Message) -> io::Result<()> { match request { - &kern::LoadRequest(_) => trace!("comm->kern LoadRequest(...)"), - _ => trace!("comm->kern {:?}", request) + &kern::LoadRequest(_) => debug!("comm->kern LoadRequest(...)"), + _ => debug!("comm->kern {:?}", request) } unsafe { mailbox::send(request as *const _ as usize) } io.until(mailbox::acknowledged) @@ -148,9 +148,9 @@ fn kern_recv_notrace(io: &Io, f: F) -> io::Result fn kern_recv_dotrace(reply: &kern::Message) { match reply { - &kern::Log(_) => trace!("comm<-kern Log(...)"), - &kern::LogSlice(_) => trace!("comm<-kern LogSlice(...)"), - _ => trace!("comm<-kern {:?}", reply) + &kern::Log(_) => debug!("comm<-kern Log(...)"), + &kern::LogSlice(_) => debug!("comm<-kern LogSlice(...)"), + _ => debug!("comm<-kern {:?}", reply) } } @@ -219,7 +219,7 @@ fn process_host_message(io: &Io, // artiq_corelog host::Request::Log => { // Logging the packet with the log is inadvisable - trace!("comm->host Log(...)"); + debug!("comm->host Log(...)"); BufferLogger::with_instance(|logger| { logger.extract(|log| { host::Reply::Log(log).write_to(stream) @@ -569,10 +569,10 @@ fn process_kern_message(io: &Io, mut stream: Option<&mut TcpStream>, fn process_kern_queued_rpc(stream: &mut TcpStream, _session: &mut Session) -> io::Result<()> { rpc_queue::dequeue(|slice| { - trace!("comm<-kern (async RPC)"); + debug!("comm<-kern (async RPC)"); let length = NetworkEndian::read_u32(slice) as usize; host_write(stream, host::Reply::RpcRequest { async: true })?; - trace!("{:?}" ,&slice[4..][..length]); + debug!("{:?}", &slice[4..][..length]); stream.write(&slice[4..][..length])?; Ok(()) }) @@ -670,7 +670,7 @@ pub fn thread(io: Io) { listener.listen(1381).expect("session: cannot listen"); info!("accepting network sessions"); - BufferLogger::with_instance(|logger| logger.disable_trace_to_uart()); + BufferLogger::with_instance(|logger| logger.enable_concise_uart()); let congress = Urc::new(RefCell::new(Congress::new()));