From ba637e6d30fd99387e735e696b9c676d3767a45f Mon Sep 17 00:00:00 2001 From: Martin Braun Date: Fri, 18 Oct 2019 15:14:36 -0700 Subject: mpmd: Add skip_oldlog device arg This device arg will avoid printing old log messages by dumping all log messages in the buffer immediately after claiming a device. This can be helpful because reading old log messages can be confusing during debug situations, or simply during situations where we expect errors to contain warnings or errors, but we want to hide them. skip_oldlog defaults to off, i.e., the previous behaviour. --- host/lib/usrp/mpmd/mpmd_mboard_impl.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'host/lib/usrp') diff --git a/host/lib/usrp/mpmd/mpmd_mboard_impl.cpp b/host/lib/usrp/mpmd/mpmd_mboard_impl.cpp index e7bd0cff9..98e92e210 100644 --- a/host/lib/usrp/mpmd/mpmd_mboard_impl.cpp +++ b/host/lib/usrp/mpmd/mpmd_mboard_impl.cpp @@ -364,6 +364,14 @@ uhd::task::sptr mpmd_mboard_impl::claim_device_and_make_task() // Save token for both RPC clients _claim_rpc->set_token(rpc_token); rpc->set_token(rpc_token); + // Optionally clear log buf + if (mb_args.has_key("skip_oldlog")) { + try { + this->dump_logs(true); + } catch (const uhd::runtime_error&) { + UHD_LOG_WARNING("MPMD", "Could not read back log queue!"); + } + } return uhd::task::make([this] { auto now = std::chrono::steady_clock::now(); if (not this->claim()) { -- cgit v1.2.3