From 365cb2dfe25664aa752c3302c22af070f73c2b22 Mon Sep 17 00:00:00 2001 From: Andre Puschmann Date: Wed, 27 Nov 2019 13:38:45 +0100 Subject: [PATCH] assign msg-type to temp variable before logging ASN1 message in RRC --- srsenb/src/stack/rrc/rrc.cc | 10 +++++----- srsue/src/stack/rrc/rrc.cc | 13 +++++++++---- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/srsenb/src/stack/rrc/rrc.cc b/srsenb/src/stack/rrc/rrc.cc index 63647d43e..19b7252c3 100644 --- a/srsenb/src/stack/rrc/rrc.cc +++ b/srsenb/src/stack/rrc/rrc.cc @@ -160,15 +160,15 @@ template void rrc::log_rrc_message(const std::string& source, const direction_t dir, const srslte::byte_buffer_t* pdu, const T& msg) { + const char* msg_type = msg.msg.c1().type().to_string().c_str(); if (rrc_log->get_level() == srslte::LOG_LEVEL_INFO) { - rrc_log->info("%s - %s %s (%d B)\n", source.c_str(), dir == Tx ? "Tx" : "Rx", - msg.msg.c1().type().to_string().c_str(), pdu->N_bytes); + rrc_log->info("%s - %s %s (%d B)\n", source.c_str(), dir == Tx ? "Tx" : "Rx", msg_type, pdu->N_bytes); } else if (rrc_log->get_level() >= srslte::LOG_LEVEL_DEBUG) { asn1::json_writer json_writer; msg.to_json(json_writer); - rrc_log->debug_hex(pdu->msg, pdu->N_bytes, "%s - %s %s (%d B)\n", source.c_str(), dir == Tx ? "Tx" : "Rx", - msg.msg.c1().type().to_string().c_str(), pdu->N_bytes); - rrc_log->debug("Content:\n%s\n", json_writer.to_string().c_str()); + rrc_log->debug_hex( + pdu->msg, pdu->N_bytes, "%s - %s %s (%d B)\n", source.c_str(), dir == Tx ? "Tx" : "Rx", msg_type, pdu->N_bytes); + rrc_log->debug_long("Content:\n%s\n", json_writer.to_string().c_str()); } } diff --git a/srsue/src/stack/rrc/rrc.cc b/srsue/src/stack/rrc/rrc.cc index 2324518ec..227b27fb1 100644 --- a/srsue/src/stack/rrc/rrc.cc +++ b/srsue/src/stack/rrc/rrc.cc @@ -78,14 +78,19 @@ void rrc::srslte_rrc_log(const char* str) template void rrc::log_rrc_message(const std::string source, const direction_t dir, const byte_buffer_t* pdu, const T& msg) { + const char* msg_type = msg.msg.c1().type().to_string().c_str(); if (rrc_log->get_level() == srslte::LOG_LEVEL_INFO) { - rrc_log->info("%s - %s %s (%d B)\n", source.c_str(), (dir == Rx) ? "Rx" : "Tx", - msg.msg.c1().type().to_string().c_str(), pdu->N_bytes); + rrc_log->info("%s - %s %s (%d B)\n", source.c_str(), (dir == Rx) ? "Rx" : "Tx", msg_type, pdu->N_bytes); } else if (rrc_log->get_level() >= srslte::LOG_LEVEL_DEBUG) { asn1::json_writer json_writer; msg.to_json(json_writer); - rrc_log->debug_hex(pdu->msg, pdu->N_bytes, "%s - %s %s (%d B)\n", source.c_str(), (dir == Rx) ? "Rx" : "Tx", - msg.msg.c1().type().to_string().c_str(), pdu->N_bytes); + rrc_log->debug_hex(pdu->msg, + pdu->N_bytes, + "%s - %s %s (%d B)\n", + source.c_str(), + (dir == Rx) ? "Rx" : "Tx", + msg_type, + pdu->N_bytes); rrc_log->debug_long("Content:\n%s\n", json_writer.to_string().c_str()); } }