From 7823bfc28c7c5fea0f6870ccf41f51401eb41c60 Mon Sep 17 00:00:00 2001 From: Xavier Arteaga Date: Tue, 13 Apr 2021 12:55:09 +0200 Subject: [PATCH] Fix append NR to loggers for NR components --- lib/include/srsran/mac/mac_sch_pdu_nr.h | 4 ++-- lib/src/mac/mac_rar_pdu_nr.cc | 4 ++-- lib/src/mac/mac_sch_pdu_nr.cc | 2 +- lib/src/srslog/formatters/text_formatter.cpp | 2 +- srsenb/src/phy/nr/worker_pool.cc | 2 +- srsenb/src/stack/gnb_stack_nr.cc | 6 +++--- srsenb/src/stack/mac/mac_nr.cc | 4 +--- srsenb/src/stack/rrc/rrc_nr.cc | 2 +- srsue/src/phy/nr/worker_pool.cc | 6 +++--- srsue/src/stack/mac_nr/mac_nr.cc | 2 +- srsue/src/stack/rrc/rrc_nr.cc | 2 +- srsue/src/stack/ue_stack_nr.cc | 12 ++++++------ 12 files changed, 23 insertions(+), 25 deletions(-) diff --git a/lib/include/srsran/mac/mac_sch_pdu_nr.h b/lib/include/srsran/mac/mac_sch_pdu_nr.h index 935c6b9e3..08da38bca 100644 --- a/lib/include/srsran/mac/mac_sch_pdu_nr.h +++ b/lib/include/srsran/mac/mac_sch_pdu_nr.h @@ -54,7 +54,7 @@ public: // SDUs up to 256 B can use the short 8-bit L field static const int32_t MAC_SUBHEADER_LEN_THRESHOLD = 256; - mac_sch_subpdu_nr(mac_sch_pdu_nr* parent_) : parent(parent_), logger(&srslog::fetch_basic_logger("MAC")){}; + mac_sch_subpdu_nr(mac_sch_pdu_nr* parent_) : parent(parent_), logger(&srslog::fetch_basic_logger("MAC-NR")){}; nr_lcid_sch_t get_type(); bool is_sdu(); @@ -120,7 +120,7 @@ private: class mac_sch_pdu_nr { public: - mac_sch_pdu_nr(bool ulsch_ = false) : ulsch(ulsch_), logger(srslog::fetch_basic_logger("MAC")) {} + mac_sch_pdu_nr(bool ulsch_ = false) : ulsch(ulsch_), logger(srslog::fetch_basic_logger("MAC-NR")) {} void pack(); int unpack(const uint8_t* payload, const uint32_t& len); diff --git a/lib/src/mac/mac_rar_pdu_nr.cc b/lib/src/mac/mac_rar_pdu_nr.cc index 83ec3718d..605571844 100644 --- a/lib/src/mac/mac_rar_pdu_nr.cc +++ b/lib/src/mac/mac_rar_pdu_nr.cc @@ -22,7 +22,7 @@ extern "C" { namespace srsran { mac_rar_subpdu_nr::mac_rar_subpdu_nr(mac_rar_pdu_nr* parent_) : - parent(parent_), logger(srslog::fetch_basic_logger("MAC")) + parent(parent_), logger(srslog::fetch_basic_logger("MAC-NR")) {} // Return true if subPDU could be parsed correctly, false otherwise @@ -147,7 +147,7 @@ std::string mac_rar_subpdu_nr::to_string() return ss.str(); } -mac_rar_pdu_nr::mac_rar_pdu_nr() : logger(srslog::fetch_basic_logger("MAC")) {} +mac_rar_pdu_nr::mac_rar_pdu_nr() : logger(srslog::fetch_basic_logger("MAC-NR")) {} bool mac_rar_pdu_nr::pack() { diff --git a/lib/src/mac/mac_sch_pdu_nr.cc b/lib/src/mac/mac_sch_pdu_nr.cc index ee2b8aeb0..e06b50831 100644 --- a/lib/src/mac/mac_sch_pdu_nr.cc +++ b/lib/src/mac/mac_sch_pdu_nr.cc @@ -67,7 +67,7 @@ int32_t mac_sch_subpdu_nr::read_subheader(const uint8_t* ptr) } sdu = (uint8_t*)ptr; } else { - srslog::fetch_basic_logger("MAC").warning("Invalid LCID (%d) in MAC PDU", lcid); + srslog::fetch_basic_logger("MAC-NR").warning("Invalid LCID (%d) in MAC PDU", lcid); return SRSRAN_ERROR; } return header_length; diff --git a/lib/src/srslog/formatters/text_formatter.cpp b/lib/src/srslog/formatters/text_formatter.cpp index c47f5e884..d89ca50eb 100644 --- a/lib/src/srslog/formatters/text_formatter.cpp +++ b/lib/src/srslog/formatters/text_formatter.cpp @@ -47,7 +47,7 @@ static void format_metadata(const detail::log_entry_metadata& metadata, fmt::mem // Format optional fields if present. if (!metadata.log_name.empty()) { - fmt::format_to(buffer, "[{: <4}] ", metadata.log_name); + fmt::format_to(buffer, "[{: <7}] ", metadata.log_name); } if (metadata.log_tag != '\0') { fmt::format_to(buffer, "[{}] ", metadata.log_tag); diff --git a/srsenb/src/phy/nr/worker_pool.cc b/srsenb/src/phy/nr/worker_pool.cc index 438de0b0b..eed75af45 100644 --- a/srsenb/src/phy/nr/worker_pool.cc +++ b/srsenb/src/phy/nr/worker_pool.cc @@ -21,7 +21,7 @@ bool worker_pool::init(const phy_args_t& args, phy_common* common, srslog::sink& // Add workers to workers pool and start threads srslog::basic_levels log_level = srslog::str_to_basic_level(args.log.phy_level); for (uint32_t i = 0; i < args.nof_phy_threads; i++) { - auto& log = srslog::fetch_basic_logger(fmt::format("PHY{}", i), log_sink); + auto& log = srslog::fetch_basic_logger(fmt::format("PHY{}-NR", i), log_sink); log.set_level(log_level); log.set_hex_dump_max_size(args.log.phy_hex_limit); diff --git a/srsenb/src/stack/gnb_stack_nr.cc b/srsenb/src/stack/gnb_stack_nr.cc index 74f07bdb2..223798334 100644 --- a/srsenb/src/stack/gnb_stack_nr.cc +++ b/srsenb/src/stack/gnb_stack_nr.cc @@ -16,11 +16,11 @@ namespace srsenb { -gnb_stack_nr::gnb_stack_nr() : task_sched{512, 128}, thread("gNB"), rlc_logger(srslog::fetch_basic_logger("RLC")) +gnb_stack_nr::gnb_stack_nr() : task_sched{512, 128}, thread("gNB"), rlc_logger(srslog::fetch_basic_logger("RLC-NR")) { m_mac.reset(new mac_nr()); - m_rlc.reset(new rlc_nr("RLC")); - m_pdcp.reset(new pdcp_nr(&task_sched, "PDCP")); + m_rlc.reset(new rlc_nr("RLC-NR")); + m_pdcp.reset(new pdcp_nr(&task_sched, "PDCP-NR")); m_rrc.reset(new rrc_nr(task_sched.get_timer_handler())); m_sdap.reset(new sdap()); m_gw.reset(new srsue::gw()); diff --git a/srsenb/src/stack/mac/mac_nr.cc b/srsenb/src/stack/mac/mac_nr.cc index 2af1db962..eafe1e7cb 100644 --- a/srsenb/src/stack/mac/mac_nr.cc +++ b/srsenb/src/stack/mac/mac_nr.cc @@ -20,9 +20,7 @@ namespace srsenb { -mac_nr::mac_nr() : logger(srslog::fetch_basic_logger("MAC")) -{ -} +mac_nr::mac_nr() : logger(srslog::fetch_basic_logger("MAC-NR")) {} mac_nr::~mac_nr() { diff --git a/srsenb/src/stack/rrc/rrc_nr.cc b/srsenb/src/stack/rrc/rrc_nr.cc index 95151fe07..9ec9719da 100644 --- a/srsenb/src/stack/rrc/rrc_nr.cc +++ b/srsenb/src/stack/rrc/rrc_nr.cc @@ -19,7 +19,7 @@ using namespace asn1::rrc_nr; namespace srsenb { -rrc_nr::rrc_nr(srsran::timer_handler* timers_) : logger(srslog::fetch_basic_logger("RRC")), timers(timers_) {} +rrc_nr::rrc_nr(srsran::timer_handler* timers_) : logger(srslog::fetch_basic_logger("RRC-NR")), timers(timers_) {} int rrc_nr::init(const rrc_nr_cfg_t& cfg_, phy_interface_stack_nr* phy_, diff --git a/srsue/src/phy/nr/worker_pool.cc b/srsue/src/phy/nr/worker_pool.cc index a429e5438..54bb9375f 100644 --- a/srsue/src/phy/nr/worker_pool.cc +++ b/srsue/src/phy/nr/worker_pool.cc @@ -14,7 +14,7 @@ namespace srsue { namespace nr { -worker_pool::worker_pool(uint32_t max_workers) : pool(max_workers), logger(srslog::fetch_basic_logger("NR-PHY")) {} +worker_pool::worker_pool(uint32_t max_workers) : pool(max_workers), logger(srslog::fetch_basic_logger("PHY-NR")) {} bool worker_pool::init(const phy_args_nr_t& args, phy_common* common, stack_interface_phy_nr* stack_, int prio) { @@ -36,7 +36,7 @@ bool worker_pool::init(const phy_args_nr_t& args, phy_common* common, stack_inte // Add workers to workers pool and start threads for (uint32_t i = 0; i < args.nof_phy_threads; i++) { - auto& log = srslog::fetch_basic_logger(fmt::format("PHY{}", i)); + auto& log = srslog::fetch_basic_logger(fmt::format("PHY{}-NR", i)); log.set_level(srslog::str_to_basic_level(args.log.phy_level)); log.set_hex_dump_max_size(args.log.phy_hex_limit); @@ -50,7 +50,7 @@ bool worker_pool::init(const phy_args_nr_t& args, phy_common* common, stack_inte } // Initialise PRACH - auto& prach_log = srslog::fetch_basic_logger("PRACH"); + auto& prach_log = srslog::fetch_basic_logger("PRACH-NR"); prach_log.set_level(srslog::str_to_basic_level(args.log.phy_level)); prach_buffer = std::unique_ptr(new prach(prach_log)); prach_buffer->init(phy_state.args.dl.nof_max_prb); diff --git a/srsue/src/stack/mac_nr/mac_nr.cc b/srsue/src/stack/mac_nr/mac_nr.cc index f452eff67..75fa30299 100644 --- a/srsue/src/stack/mac_nr/mac_nr.cc +++ b/srsue/src/stack/mac_nr/mac_nr.cc @@ -19,7 +19,7 @@ namespace srsue { mac_nr::mac_nr(srsran::ext_task_sched_handle task_sched_) : task_sched(task_sched_), - logger(srslog::fetch_basic_logger("MAC")), + logger(srslog::fetch_basic_logger("MAC-NR")), proc_ra(*this, logger), proc_sr(logger), proc_bsr(logger), diff --git a/srsue/src/stack/rrc/rrc_nr.cc b/srsue/src/stack/rrc/rrc_nr.cc index a42946ccd..65b513124 100644 --- a/srsue/src/stack/rrc/rrc_nr.cc +++ b/srsue/src/stack/rrc/rrc_nr.cc @@ -30,7 +30,7 @@ namespace srsue { const char* rrc_nr::rrc_nr_state_text[] = {"IDLE", "CONNECTED", "CONNECTED-INACTIVE"}; rrc_nr::rrc_nr(srsran::task_sched_handle task_sched_) : - logger(srslog::fetch_basic_logger("RRC")), task_sched(task_sched_), conn_recfg_proc(this) + logger(srslog::fetch_basic_logger("RRC-NR")), task_sched(task_sched_), conn_recfg_proc(this) {} rrc_nr::~rrc_nr() = default; diff --git a/srsue/src/stack/ue_stack_nr.cc b/srsue/src/stack/ue_stack_nr.cc index 11761aaa2..0ece33a82 100644 --- a/srsue/src/stack/ue_stack_nr.cc +++ b/srsue/src/stack/ue_stack_nr.cc @@ -18,16 +18,16 @@ using namespace srsran; namespace srsue { ue_stack_nr::ue_stack_nr() : - thread("STACK"), + thread("STACK-NR"), task_sched(64, 64), - mac_logger(srslog::fetch_basic_logger("MAC")), - rlc_logger(srslog::fetch_basic_logger("RLC", false)), - pdcp_logger(srslog::fetch_basic_logger("PDCP", false)) + mac_logger(srslog::fetch_basic_logger("MAC-NR")), + rlc_logger(srslog::fetch_basic_logger("RLC-NR", false)), + pdcp_logger(srslog::fetch_basic_logger("PDCP-NR", false)) { get_background_workers().set_nof_workers(2); mac.reset(new mac_nr(&task_sched)); - pdcp.reset(new srsran::pdcp(&task_sched, "PDCP")); - rlc.reset(new srsran::rlc("RLC")); + pdcp.reset(new srsran::pdcp(&task_sched, "PDCP-NR")); + rlc.reset(new srsran::rlc("RLC-NR")); rrc.reset(new rrc_nr(&task_sched)); // setup logging for pool, RLC and PDCP