From ac62e3c39888a2d24095373b2606e6504524617a Mon Sep 17 00:00:00 2001 From: faluco Date: Mon, 1 Feb 2021 18:38:31 +0100 Subject: [PATCH] Fix the priority of logging levels in places where we before logging we check if a certain log level is enabled. --- srsenb/hdr/stack/rrc/rrc.h | 6 +++--- srsenb/src/stack/mac/sched_helpers.cc | 9 +++++---- srsue/src/stack/rrc/rrc.cc | 8 +++----- 3 files changed, 11 insertions(+), 12 deletions(-) diff --git a/srsenb/hdr/stack/rrc/rrc.h b/srsenb/hdr/stack/rrc/rrc.h index cbe188891..517578b26 100644 --- a/srsenb/hdr/stack/rrc/rrc.h +++ b/srsenb/hdr/stack/rrc/rrc.h @@ -125,14 +125,14 @@ public: const std::string& msg_type) { static const char* dir_str[] = {"Rx", "Tx", "S1AP Tx", "S1AP Rx"}; - if (logger.info.enabled()) { - logger.info("%s - %s %s (%zd B)", source.c_str(), dir_str[dir], msg_type.c_str(), pdu.size()); - } else if (logger.debug.enabled()) { + if (logger.debug.enabled()) { asn1::json_writer json_writer; msg.to_json(json_writer); logger.debug( pdu.data(), pdu.size(), "%s - %s %s (%zd B)", source.c_str(), dir_str[dir], msg_type.c_str(), pdu.size()); logger.debug("Content:\n%s", json_writer.to_string().c_str()); + } else if (logger.info.enabled()) { + logger.info("%s - %s %s (%zd B)", source.c_str(), dir_str[dir], msg_type.c_str(), pdu.size()); } } diff --git a/srsenb/src/stack/mac/sched_helpers.cc b/srsenb/src/stack/mac/sched_helpers.cc index 2ae628916..d20464840 100644 --- a/srsenb/src/stack/mac/sched_helpers.cc +++ b/srsenb/src/stack/mac/sched_helpers.cc @@ -103,16 +103,17 @@ void fill_dl_cc_result_debug(custom_mem_buffer& strbuf, const dl_sched_data_t& d void log_dl_cc_results(srslog::basic_logger& logger, uint32_t enb_cc_idx, const sched_interface::dl_sched_res_t& result) { - if (!logger.info.enabled()) { + if (!logger.info.enabled() && !logger.debug.enabled()) { return; } + custom_mem_buffer strbuf; for (uint32_t i = 0; i < result.nof_data_elems; ++i) { const dl_sched_data_t& data = result.data[i]; - if (logger.info.enabled()) { - fill_dl_cc_result_info(strbuf, data); - } else if (logger.debug.enabled()) { + if (logger.debug.enabled()) { fill_dl_cc_result_debug(strbuf, data); + } else { + fill_dl_cc_result_info(strbuf, data); } } if (strbuf.size() != 0) { diff --git a/srsue/src/stack/rrc/rrc.cc b/srsue/src/stack/rrc/rrc.cc index 8c0021610..abfb277c4 100644 --- a/srsue/src/stack/rrc/rrc.cc +++ b/srsue/src/stack/rrc/rrc.cc @@ -76,9 +76,7 @@ void rrc::log_rrc_message(const std::string source, const T& msg, const std::string& msg_type) { - if (logger.info.enabled()) { - logger.info("%s - %s %s (%d B)", source.c_str(), (dir == Rx) ? "Rx" : "Tx", msg_type.c_str(), pdu->N_bytes); - } else if (logger.debug.enabled()) { + if (logger.debug.enabled()) { asn1::json_writer json_writer; msg.to_json(json_writer); logger.debug(pdu->msg, @@ -89,6 +87,8 @@ void rrc::log_rrc_message(const std::string source, msg_type.c_str(), pdu->N_bytes); logger.debug("Content:\n%s", json_writer.to_string().c_str()); + } else if (logger.info.enabled()) { + logger.info("%s - %s %s (%d B)", source.c_str(), (dir == Rx) ? "Rx" : "Tx", msg_type.c_str(), pdu->N_bytes); } } @@ -399,7 +399,6 @@ void rrc::process_cell_meas_nr() void rrc::process_new_cell_meas_nr(const std::vector& meas) { - // Convert vector std::vector meas_lte; for (const auto& m : meas) { @@ -1870,7 +1869,6 @@ void rrc::handle_ue_capability_enquiry(const ue_cap_enquiry_s& enquiry) } if (args.release > 9) { - phy_layer_params_v1020_s phy_layer_params_v1020; phy_layer_params_v1020.two_ant_ports_for_pucch_r10_present = false; phy_layer_params_v1020.tm9_with_minus8_tx_fdd_r10_present = false;