diff --git a/srsue/hdr/phy/lte/worker_pool.h b/srsue/hdr/phy/lte/worker_pool.h index d35886269..ad757c99c 100644 --- a/srsue/hdr/phy/lte/worker_pool.h +++ b/srsue/hdr/phy/lte/worker_pool.h @@ -28,7 +28,7 @@ public: sf_worker* operator[](std::size_t pos) { return workers.at(pos).get(); } worker_pool(uint32_t max_workers); - bool init(phy_common* common, srslog::sink& log_sink, int prio); + bool init(phy_common* common, int prio); sf_worker* wait_worker(uint32_t tti); sf_worker* wait_worker_id(uint32_t id); void start_worker(sf_worker* w); diff --git a/srsue/hdr/phy/phy.h b/srsue/hdr/phy/phy.h index ba9facef5..e24512e14 100644 --- a/srsue/hdr/phy/phy.h +++ b/srsue/hdr/phy/phy.h @@ -69,10 +69,9 @@ private: class phy final : public ue_lte_phy_base, public ue_nr_phy_base, public srslte::thread { public: - explicit phy(srslog::sink& log_sink) : - log_sink(log_sink), - logger_phy(srslog::fetch_basic_logger("PHY", log_sink)), - logger_phy_lib(srslog::fetch_basic_logger("PHY_LIB", log_sink)), + explicit phy() : + logger_phy(srslog::fetch_basic_logger("PHY")), + logger_phy_lib(srslog::fetch_basic_logger("PHY_LIB")), lte_workers(MAX_WORKERS), nr_workers(MAX_WORKERS, log_sink), common(logger_phy), @@ -197,7 +196,6 @@ private: const static int WORKERS_THREAD_PRIO = 2; srslte::radio_interface_phy* radio = nullptr; - srslog::sink& log_sink; srslog::basic_logger& logger_phy; srslog::basic_logger& logger_phy_lib; diff --git a/srsue/hdr/stack/ue_stack_lte.h b/srsue/hdr/stack/ue_stack_lte.h index aff796265..b2d1d3cc2 100644 --- a/srsue/hdr/stack/ue_stack_lte.h +++ b/srsue/hdr/stack/ue_stack_lte.h @@ -52,7 +52,7 @@ class ue_stack_lte final : public ue_stack_base, public srslte::thread { public: - explicit ue_stack_lte(srslog::sink& log_sink); + explicit ue_stack_lte(); ~ue_stack_lte(); std::string get_type() final; diff --git a/srsue/hdr/ue.h b/srsue/hdr/ue.h index 3dbdebdf9..cd416f7ca 100644 --- a/srsue/hdr/ue.h +++ b/srsue/hdr/ue.h @@ -84,7 +84,7 @@ typedef struct { class ue : public ue_metrics_interface { public: - ue(srslog::sink& log_sink); + ue(); ~ue(); int init(const all_args_t& args_, srslte::logger* logger_); @@ -107,7 +107,6 @@ private: // Generic logger members srslte::logger* old_logger = nullptr; - srslog::sink& log_sink; srslog::basic_logger& logger; all_args_t args; diff --git a/srsue/src/main.cc b/srsue/src/main.cc index eb7a0e5e5..7b60dbe9c 100644 --- a/srsue/src/main.cc +++ b/srsue/src/main.cc @@ -470,7 +470,6 @@ static int parse_args(all_args_t* args, int argc, char* argv[]) // if no config file given, check users home path if (!vm.count("config_file")) { - if (!config_exists(config_file, "ue.conf")) { cout << "Failed to read UE configuration file " << config_file << " - exiting" << endl; return SRSLTE_ERROR; @@ -652,7 +651,7 @@ int main(int argc, char* argv[]) srslte::check_scaling_governor(args.rf.device_name); // Create UE instance - srsue::ue ue(*log_sink); + srsue::ue ue; if (ue.init(args, &log_wrapper)) { ue.stop(); return SRSLTE_SUCCESS; diff --git a/srsue/src/phy/lte/worker_pool.cc b/srsue/src/phy/lte/worker_pool.cc index 17969aaf6..547b12a25 100644 --- a/srsue/src/phy/lte/worker_pool.cc +++ b/srsue/src/phy/lte/worker_pool.cc @@ -16,16 +16,15 @@ namespace lte { worker_pool::worker_pool(uint32_t max_workers) : pool(max_workers) {} -bool worker_pool::init(phy_common* common, srslog::sink& log_sink, int prio) +bool worker_pool::init(phy_common* common, int prio) { // Add workers to workers pool and start threads for (uint32_t i = 0; i < common->args->nof_phy_threads; i++) { - srslog::basic_logger &log = srslog::fetch_basic_logger(fmt::format("PHY{}", i), log_sink); + srslog::basic_logger& log = srslog::fetch_basic_logger(fmt::format("PHY{}", i)); log.set_level(srslog::str_to_basic_level(common->args->log.phy_level)); log.set_hex_dump_max_size(common->args->log.phy_hex_limit); - auto w = - std::unique_ptr(new lte::sf_worker(SRSLTE_MAX_PRB, common, log)); + auto w = std::unique_ptr(new lte::sf_worker(SRSLTE_MAX_PRB, common, log)); pool.init_worker(i, w.get(), prio, common->args->worker_cpu_mask); workers.push_back(std::move(w)); } diff --git a/srsue/src/phy/phy.cc b/srsue/src/phy/phy.cc index 92923f658..c91d74f7b 100644 --- a/srsue/src/phy/phy.cc +++ b/srsue/src/phy/phy.cc @@ -147,7 +147,7 @@ void phy::run_thread() common.init(&args, radio, stack, &sfsync); // Initialise workers - lte_workers.init(&common, log_sink, WORKERS_THREAD_PRIO); + lte_workers.init(&common, WORKERS_THREAD_PRIO); // Warning this must be initialized after all workers have been added to the pool sfsync.init( diff --git a/srsue/src/stack/ue_stack_lte.cc b/srsue/src/stack/ue_stack_lte.cc index 2c305c246..68238dbd5 100644 --- a/srsue/src/stack/ue_stack_lte.cc +++ b/srsue/src/stack/ue_stack_lte.cc @@ -22,16 +22,16 @@ using namespace srslte; namespace srsue { -ue_stack_lte::ue_stack_lte(srslog::sink& log_sink) : +ue_stack_lte::ue_stack_lte() : running(false), args(), - stack_logger(srslog::fetch_basic_logger("STCK", log_sink, false)), - mac_logger(srslog::fetch_basic_logger("MAC", log_sink)), - rlc_logger(srslog::fetch_basic_logger("RLC", log_sink, false)), - pdcp_logger(srslog::fetch_basic_logger("PDCP", log_sink, false)), - rrc_logger(srslog::fetch_basic_logger("RRC", log_sink, false)), - usim_logger(srslog::fetch_basic_logger("USIM", log_sink, false)), - nas_logger(srslog::fetch_basic_logger("NAS", log_sink, false)), + stack_logger(srslog::fetch_basic_logger("STCK", false)), + mac_logger(srslog::fetch_basic_logger("MAC")), + rlc_logger(srslog::fetch_basic_logger("RLC", false)), + pdcp_logger(srslog::fetch_basic_logger("PDCP", false)), + rrc_logger(srslog::fetch_basic_logger("RRC", false)), + usim_logger(srslog::fetch_basic_logger("USIM", false)), + nas_logger(srslog::fetch_basic_logger("NAS", false)), usim(nullptr), phy(nullptr), rlc("RLC"), diff --git a/srsue/src/ue.cc b/srsue/src/ue.cc index 7ac716b27..7d24e9bfd 100644 --- a/srsue/src/ue.cc +++ b/srsue/src/ue.cc @@ -29,8 +29,7 @@ using namespace srslte; namespace srsue { -ue::ue(srslog::sink& log_sink) : - old_logger(nullptr), log_sink(log_sink), logger(srslog::fetch_basic_logger("UE", log_sink, false)) +ue::ue() : old_logger(nullptr), logger(srslog::fetch_basic_logger("UE", false)) { // print build info std::cout << std::endl << get_build_string() << std::endl << std::endl; @@ -58,7 +57,7 @@ int ue::init(const all_args_t& args_, srslte::logger* logger_) // Instantiate layers and stack together our UE if (args.stack.type == "lte") { - std::unique_ptr lte_stack(new ue_stack_lte(log_sink)); + std::unique_ptr lte_stack(new ue_stack_lte); if (!lte_stack) { srslte::console("Error creating LTE stack instance.\n"); return SRSLTE_ERROR; @@ -70,7 +69,7 @@ int ue::init(const all_args_t& args_, srslte::logger* logger_) return SRSLTE_ERROR; } - std::unique_ptr lte_phy = std::unique_ptr(new srsue::phy(log_sink)); + std::unique_ptr lte_phy = std::unique_ptr(new srsue::phy); if (!lte_phy) { srslte::console("Error creating LTE PHY instance.\n"); return SRSLTE_ERROR; diff --git a/srsue/test/mac_test.cc b/srsue/test/mac_test.cc index e11b0b1c2..fc890ec4c 100644 --- a/srsue/test/mac_test.cc +++ b/srsue/test/mac_test.cc @@ -2375,13 +2375,6 @@ int main(int argc, char** argv) phy_logger.set_hex_dump_max_size(100000); srslog::init(); - srslte::log_filter rlc_log("RLC"); - rlc_log.set_level(srslte::LOG_LEVEL_DEBUG); - rlc_log.set_hex_limit(100000); - srslte::log_filter mac_log("MAC"); - mac_log.set_level(srslte::LOG_LEVEL_DEBUG); - mac_log.set_hex_limit(100000); - TESTASSERT(mac_unpack_test() == SRSLTE_SUCCESS); TESTASSERT(mac_ul_sch_pdu_test1() == SRSLTE_SUCCESS); TESTASSERT(mac_ul_logical_channel_prioritization_test1() == SRSLTE_SUCCESS); diff --git a/srsue/test/phy/scell_search_test.cc b/srsue/test/phy/scell_search_test.cc index 1f4e680b1..47a55b429 100644 --- a/srsue/test/phy/scell_search_test.cc +++ b/srsue/test/phy/scell_search_test.cc @@ -413,8 +413,7 @@ int main(int argc, char** argv) srslte_softbuffer_tx_t* softbuffer_tx[SRSLTE_MAX_TB] = {}; // Over-the-air only - std::unique_ptr radio = nullptr; - std::unique_ptr radio_log = nullptr; + std::unique_ptr radio = nullptr; // Set Receiver args common.args = &phy_args; diff --git a/srsue/test/phy/ue_phy_test.cc b/srsue/test/phy/ue_phy_test.cc index b14d73c9f..31a9bc596 100644 --- a/srsue/test/phy/ue_phy_test.cc +++ b/srsue/test/phy/ue_phy_test.cc @@ -364,7 +364,7 @@ private: std::condition_variable cvar; public: - phy_test_bench(const srsue::phy_args_t& phy_args, const srslte_cell_t& cell, srslte::logger& logger_) : + phy_test_bench(const srsue::phy_args_t& phy_args, const srslte_cell_t& cell) : radio(cell.nof_ports, srslte_sampling_freq_hz(cell.nof_prb)), thread("phy_test_bench"), logger(srslog::fetch_basic_logger("test bench", false)) @@ -373,7 +373,7 @@ public: sf_len = SRSLTE_SF_LEN_PRB(cell.nof_prb); // Initialise UE - phy = std::unique_ptr(new srsue::phy(srslog::get_default_sink())); + phy = std::unique_ptr(new srsue::phy); phy->init(phy_args, &stack, &radio); // Initialise DL baseband buffers @@ -501,15 +501,11 @@ int main(int argc, char** argv) // Set custom test cell and arguments here phy_args.log.phy_level = "info"; - // Setup logging. - srslte::srslog_wrapper log_wrapper(srslog::fetch_log_channel("main_channel")); - // Start the log backend. srslog::init(); // Create test bench - std::unique_ptr phy_test = - std::unique_ptr(new phy_test_bench(phy_args, cell, log_wrapper)); + std::unique_ptr phy_test = std::unique_ptr(new phy_test_bench(phy_args, cell)); phy_test->set_loglevel("info"); // Start test bench diff --git a/srsue/test/ttcn3/src/ttcn3_ue.cc b/srsue/test/ttcn3/src/ttcn3_ue.cc index 36db97752..db25651b4 100644 --- a/srsue/test/ttcn3/src/ttcn3_ue.cc +++ b/srsue/test/ttcn3/src/ttcn3_ue.cc @@ -55,7 +55,7 @@ int ttcn3_ue::init(all_args_t args, syssim_interface_phy* syssim_, const std::st // Instantiate layers and stack together our UE if (args.stack.type == "lte") { - stack = std::unique_ptr(new ue_stack_lte(srslog::get_default_sink())); + stack = std::unique_ptr(new ue_stack_lte); if (!stack) { srslte::console("Error creating LTE stack instance.\n"); return SRSLTE_ERROR; diff --git a/srsue/test/upper/nas_test.cc b/srsue/test/upper/nas_test.cc index ccef5d163..febb45dbe 100644 --- a/srsue/test/upper/nas_test.cc +++ b/srsue/test/upper/nas_test.cc @@ -207,14 +207,7 @@ class gw_dummy : public gw_interface_nas, public gw_interface_pdcp int security_command_test() { - int ret = SRSLTE_ERROR; - srslte::log_filter rrc_log("RRC"); - srslte::log_filter mac_log("MAC"); - srslte::log_filter usim_log("USIM"); - - rrc_log.set_level(srslte::LOG_LEVEL_DEBUG); - rrc_log.set_hex_limit(100000); - + int ret = SRSLTE_ERROR; stack_test_dummy stack; rrc_dummy rrc_dummy; @@ -267,18 +260,7 @@ int security_command_test() int mme_attach_request_test() { - int ret = SRSLTE_ERROR; - srslte::log_filter rrc_log("RRC"); - srslte::log_filter mac_log("MAC"); - srslte::log_filter usim_log("USIM"); - srslte::log_filter gw_log("GW"); - - rrc_log.set_level(srslte::LOG_LEVEL_DEBUG); - usim_log.set_level(srslte::LOG_LEVEL_DEBUG); - gw_log.set_level(srslte::LOG_LEVEL_DEBUG); - rrc_log.set_hex_limit(100000); - usim_log.set_hex_limit(100000); - gw_log.set_hex_limit(100000); + int ret = SRSLTE_ERROR; rrc_dummy rrc_dummy; pdcp_dummy pdcp_dummy; @@ -344,13 +326,7 @@ int mme_attach_request_test() int esm_info_request_test() { - int ret = SRSLTE_ERROR; - srslte::log_filter rrc_log("RRC"); - srslte::log_filter mac_log("MAC"); - srslte::log_filter usim_log("USIM"); - - rrc_log.set_level(srslte::LOG_LEVEL_DEBUG); - rrc_log.set_hex_limit(100000); + int ret = SRSLTE_ERROR; srsue::stack_test_dummy stack{}; @@ -394,13 +370,6 @@ int esm_info_request_test() int dedicated_eps_bearer_test() { - srslte::log_filter rrc_log("RRC"); - srslte::log_filter mac_log("MAC"); - srslte::log_filter usim_log("USIM"); - - rrc_log.set_level(srslte::LOG_LEVEL_DEBUG); - rrc_log.set_hex_limit(100000); - srsue::stack_test_dummy stack; rrc_dummy rrc_dummy; diff --git a/srsue/test/upper/rrc_meas_test.cc b/srsue/test/upper/rrc_meas_test.cc index 69a9a52ff..d5090a907 100644 --- a/srsue/test/upper/rrc_meas_test.cc +++ b/srsue/test/upper/rrc_meas_test.cc @@ -248,11 +248,11 @@ class rrc_test : public rrc stack_test_dummy* stack = nullptr; public: - rrc_test(srslte::log_ref log_, stack_test_dummy* stack_) : + rrc_test(const std::string& log_name, stack_test_dummy* stack_) : rrc(stack_, &stack_->task_sched), stack(stack_), mactest(this, &stack_->task_sched) { nastest = std::unique_ptr(new nas_test(&stack->task_sched)); - pdcptest = std::unique_ptr(new pdcp_test(log_->get_service_name().c_str(), &stack->task_sched)); + pdcptest = std::unique_ptr(new pdcp_test(log_name.c_str(), &stack->task_sched)); rrcnrtest = std::unique_ptr(new rrc_nr_test()); } void init() @@ -373,12 +373,6 @@ private: // Test Cell select int cell_select_test() { - srslte::log_ref log1("RRC_MEAS"), rrc_log("RRC"); - log1->set_level(srslte::LOG_LEVEL_DEBUG); - log1->set_hex_limit(-1); - rrc_log->set_level(srslte::LOG_LEVEL_DEBUG); - rrc_log->set_hex_limit(-1); - printf("==========================================================\n"); printf("====== Cell Select Testing ===============\n"); printf("==========================================================\n"); @@ -387,7 +381,7 @@ int cell_select_test() // CHECK: The starting serving cell pci=2 is the weakest, and cell selection procedure chooses pci=1 // CHECK: phy cell selection is successful, and rrc remains in pci=1 stack_test_dummy stack; - rrc_test rrctest(log1, &stack); + rrc_test rrctest(srslog::fetch_basic_logger("RRC_MEAS").id(), &stack); rrctest.init(); rrctest.connect(); @@ -418,7 +412,7 @@ int cell_select_test() // for pci=1. // CHECK: Cell selection fails in the phy, and rrc moves to pci=2 stack_test_dummy stack; - rrc_test rrctest(log1, &stack); + rrc_test rrctest(srslog::fetch_basic_logger("RRC_MEAS").id(), &stack); rrctest.init(); rrctest.connect(); @@ -478,9 +472,6 @@ int cell_select_test() // Tests the measObject configuration and the successful activation of PHY cells to search for int meas_obj_test() { - srslte::log_ref log1("RRC_MEAS"); - log1->set_level(srslte::LOG_LEVEL_DEBUG); - log1->set_hex_limit(-1); auto& rrc_meas_logger = srslog::fetch_basic_logger("RRC_MEAS"); printf("==========================================================\n"); @@ -488,7 +479,7 @@ int meas_obj_test() printf("==========================================================\n"); stack_test_dummy stack; - rrc_test rrctest(log1, &stack); + rrc_test rrctest(rrc_meas_logger.id(), &stack); rrctest.init(); rrctest.connect(); @@ -903,11 +894,6 @@ int a1event_report_test(uint32_t a1_rsrp_th, report_cfg_eutra_s::report_amount_e_ report_amount, report_interv_e report_interv) { - srslte::log_ref log1("RRC_MEAS"), rrc_log("RRC"); - log1->set_level(srslte::LOG_LEVEL_DEBUG); - log1->set_hex_limit(-1); - rrc_log->set_level(srslte::LOG_LEVEL_DEBUG); - rrc_log->set_hex_limit(-1); auto& rrc_meas_logger = srslog::fetch_basic_logger("RRC_MEAS"); printf("==========================================================\n"); @@ -915,7 +901,7 @@ int a1event_report_test(uint32_t a1_rsrp_th, printf("==========================================================\n"); stack_test_dummy stack; - rrc_test rrctest(log1, &stack); + rrc_test rrctest(rrc_meas_logger.id(), &stack); rrctest.init(); rrctest.connect(); @@ -1039,11 +1025,6 @@ int a1event_report_test(uint32_t a1_rsrp_th, // Test A3-event reporting and management of report amount and interval int a3event_report_test(uint32_t a3_offset, uint32_t hyst, bool report_on_leave) { - srslte::log_ref log1("RRC_MEAS"), rrc_log("RRC"); - log1->set_level(srslte::LOG_LEVEL_DEBUG); - log1->set_hex_limit(-1); - rrc_log->set_level(srslte::LOG_LEVEL_DEBUG); - rrc_log->set_hex_limit(-1); auto& rrc_meas_logger = srslog::fetch_basic_logger("RRC_MEAS"); printf("==========================================================\n"); @@ -1051,7 +1032,7 @@ int a3event_report_test(uint32_t a3_offset, uint32_t hyst, bool report_on_leave) printf("==========================================================\n"); stack_test_dummy stack; - rrc_test rrctest(log1, &stack); + rrc_test rrctest(rrc_meas_logger.id(), &stack); rrctest.init(); rrctest.connect(); @@ -1157,18 +1138,12 @@ int a3event_report_test(uint32_t a3_offset, uint32_t hyst, bool report_on_leave) // Minimal testcase for testing inter rat reporting with nr int meas_obj_inter_rat_nr_test() { - srslte::log_ref log1("RRC_MEAS"), rrc_log("RRC"); - log1->set_level(srslte::LOG_LEVEL_DEBUG); - log1->set_hex_limit(-1); - rrc_log->set_level(srslte::LOG_LEVEL_DEBUG); - rrc_log->set_hex_limit(-1); - printf("==========================================================\n"); printf("====== NR Inter Rat Configuration Testing ==========\n"); printf("==========================================================\n"); stack_test_dummy stack; - rrc_test rrctest(log1, &stack); + rrc_test rrctest(srslog::fetch_basic_logger("RRC_MEAS").id(), &stack); rrctest.init(); rrctest.connect(); diff --git a/srsue/test/upper/rrc_reconfig_test.cc b/srsue/test/upper/rrc_reconfig_test.cc index 553659061..4c538373c 100644 --- a/srsue/test/upper/rrc_reconfig_test.cc +++ b/srsue/test/upper/rrc_reconfig_test.cc @@ -30,10 +30,6 @@ using namespace asn1::rrc; int nas_test() { - srslte::log_filter log1("NAS"); - log1.set_level(srslte::LOG_LEVEL_DEBUG); - log1.set_hex_limit(-1); - uint8_t nas_message[128] = {0x27, 0x4f, 0xab, 0xef, 0x59, 0x01, 0x07, 0x42, 0x01, 0x49, 0x06, 0x40, 0x00, 0xf1, 0x10, 0x31, 0x32, 0x00, 0x22, 0x52, 0x01, 0xc1, 0x05, 0x07, 0xff, 0xff, 0xff, 0xff, 0x0c, 0x0b, 0x76, 0x7a, 0x77, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x65, 0x74, 0x05, 0x01, 0x0e, 0x0e, @@ -90,10 +86,6 @@ int nas_test() int meas_obj_test() { - srslte::log_filter log1("RRC"); - log1.set_level(srslte::LOG_LEVEL_DEBUG); - log1.set_hex_limit(-1); - asn1::rrc::dl_dcch_msg_s dl_dcch_msg; uint8_t rrc_msg[256] = {