move configuration of default logger to main

this prevents the case where a layer requests a new log_filter
before the default logger has been configured
master
Andre Puschmann 5 years ago
parent 5302fcfa4d
commit bbacc35e24

@ -21,6 +21,8 @@
#include "logger.h" #include "logger.h"
#include "singleton.h" #include "singleton.h"
#include "srslte/common/log_filter.h"
#include "srslte/common/logger_stdout.h"
#include <mutex> #include <mutex>
#include <unordered_map> #include <unordered_map>

@ -33,6 +33,7 @@
#include "srslte/common/config_file.h" #include "srslte/common/config_file.h"
#include "srslte/common/crash_handler.h" #include "srslte/common/crash_handler.h"
#include "srslte/common/logmap.h"
#include "srslte/common/metrics_hub.h" #include "srslte/common/metrics_hub.h"
#include "srslte/srslte.h" #include "srslte/srslte.h"
#include "srslte/version.h" #include "srslte/version.h"
@ -571,6 +572,7 @@ int main(int argc, char* argv[])
logger_file.init(args.log.filename, args.log.file_max_size); logger_file.init(args.log.filename, args.log.file_max_size);
logger = &logger_file; logger = &logger_file;
} }
srslte::logmap::get_instance()->set_default_logger(logger);
// Create UE instance // Create UE instance
srsue::ue ue; srsue::ue ue;

@ -83,7 +83,6 @@ int ue_stack_lte::init(const stack_args_t& args_, srslte::logger* logger_)
logger = logger_; logger = logger_;
// setup logging for each layer // setup logging for each layer
logmap::get_instance()->set_default_logger(logger);
mac_log.init("MAC ", logger, true); mac_log.init("MAC ", logger, true);
rlc_log.init("RLC ", logger); rlc_log.init("RLC ", logger);
pdcp_log.init("PDCP", logger); pdcp_log.init("PDCP", logger);

@ -51,7 +51,7 @@ std::string get_filename_with_tc_name(const std::string& str, const uint32_t run
result.push_back(start); result.push_back(start);
// prepend TC name to last element (the actual filename) // prepend TC name to last element (the actual filename)
stringstream filename_ss; std::stringstream filename_ss;
filename_ss << tc_name << "_" filename_ss << tc_name << "_"
<< "run" << run_id << "_" << result.back(); << "run" << run_id << "_" << result.back();

@ -22,18 +22,13 @@
#include "rapidjson/document.h" // rapidjson's DOM-style API #include "rapidjson/document.h" // rapidjson's DOM-style API
#include "rapidjson/prettywriter.h" // for stringify JSON #include "rapidjson/prettywriter.h" // for stringify JSON
#include "srslte/build_info.h" #include "srslte/build_info.h"
#include "srslte/common/log_filter.h" #include "srslte/common/logmap.h"
#include "srslte/common/logger_stdout.h"
#include "srsue/hdr/ue.h" #include "srsue/hdr/ue.h"
#include "ttcn3_helpers.h"
#include "ttcn3_syssim.h" #include "ttcn3_syssim.h"
#include <assert.h>
#include <boost/program_options.hpp> #include <boost/program_options.hpp>
#include <boost/program_options/parsers.hpp> #include <boost/program_options/parsers.hpp>
#include <iostream> #include <iostream>
#include <pthread.h>
#include <signal.h> #include <signal.h>
#include <srslte/interfaces/ue_interfaces.h>
using namespace srslte; using namespace srslte;
using namespace srsue; using namespace srsue;
@ -138,6 +133,7 @@ int main(int argc, char** argv)
// Instantiate file logger // Instantiate file logger
srslte::logger_file logger_file; srslte::logger_file logger_file;
srslte::logmap::get_instance()->set_default_logger(&logger_file);
// create and init SYSSIM // create and init SYSSIM
ttcn3_syssim syssim(&logger_file); ttcn3_syssim syssim(&logger_file);

Loading…
Cancel
Save