Added option to ue.conf/enb.conf to forward logs to stdout

master
Ismael Gomez 7 years ago
parent 05306d6a05
commit 4753366096

@ -98,8 +98,9 @@ filename = /tmp/enb.pcap
# Logging layers: phy, mac, rlc, pdcp, rrc, nas, gtpu, usim, all
# Logging levels: debug, info, warning, error, none
#
# filename: File path to use for log output
#####################################################################
# filename: File path to use for log output. Can be set to stdout
# to print logs to standard output
git c#####################################################################
[log]
all_level = info
all_hex_limit = 32

@ -138,8 +138,6 @@ typedef struct {
Main UE class
*******************************************************************************/
//#define LOG_STDOUT
class enb
:public enb_metrics_interface {
public:
@ -180,11 +178,10 @@ private:
srsenb::gtpu gtpu;
srsenb::s1ap s1ap;
#ifdef LOG_STDOUT
srslte::logger_stdout logger;
#else
srslte::logger_file logger;
#endif
srslte::logger_stdout logger_stdout;
srslte::logger_file logger_file;
srslte::logger *logger;
srslte::log_filter rf_log;
std::vector<void*> phy_log;
srslte::log_filter mac_log;

@ -26,6 +26,7 @@
#include <boost/algorithm/string.hpp>
#include <boost/thread/mutex.hpp>
#include <enb.h>
#include "enb.h"
namespace srsenb {
@ -68,30 +69,34 @@ bool enb::init(all_args_t *args_)
{
args = args_;
#ifndef LOG_STDOUT
logger.init(args->log.filename);
#endif
rf_log.init("RF ", &logger);
if (!args->log.filename.compare("stdout")) {
logger = &logger_stdout;
printf("log name is output\n");
} else {
printf("lgo name is %s\n", args->log.filename.c_str());
logger_file.init(args->log.filename);
logger_file.log("\n\n");
logger = &logger_file;
}
rf_log.init("RF ", logger);
// Create array of pointers to phy_logs
for (int i=0;i<args->expert.phy.nof_phy_threads;i++) {
srslte::log_filter *mylog = new srslte::log_filter;
char tmp[16];
sprintf(tmp, "PHY%d",i);
mylog->init(tmp, &logger, true);
mylog->init(tmp, logger, true);
phy_log.push_back((void*) mylog);
}
mac_log.init("MAC ", &logger, true);
rlc_log.init("RLC ", &logger);
pdcp_log.init("PDCP", &logger);
rrc_log.init("RRC ", &logger);
gtpu_log.init("GTPU", &logger);
s1ap_log.init("S1AP", &logger);
mac_log.init("MAC ", logger, true);
rlc_log.init("RLC ", logger);
pdcp_log.init("PDCP", logger);
rrc_log.init("RRC ", logger);
gtpu_log.init("GTPU", logger);
s1ap_log.init("S1AP", logger);
// Init logs
#ifndef LOG_STDOUT
logger.log("\n\n");
#endif
rf_log.set_level(srslte::LOG_LEVEL_INFO);
for (int i=0;i<args->expert.phy.nof_phy_threads;i++) {
((srslte::log_filter*) phy_log[i])->set_level(level(args->log.phy_level));

@ -57,8 +57,6 @@
namespace srsue {
//#define LOG_STDOUT
/*******************************************************************************
Main UE class
*******************************************************************************/
@ -97,11 +95,10 @@ private:
srsue::gw gw;
srsue::usim usim;
#ifdef LOG_STDOUT
srslte::logger_stdout logger;
#else
srslte::logger_file logger;
#endif
srslte::logger_stdout logger_stdout;
srslte::logger_file logger_file;
srslte::logger *logger;
// rf_log is on ue_base
std::vector<void*> phy_log;
srslte::log_filter mac_log;

@ -103,6 +103,7 @@ void parse_args(all_args_t *args, int argc, char *argv[]) {
("log.usim_level", bpo::value<string>(&args->log.usim_level), "USIM log level")
("log.usim_hex_limit", bpo::value<int>(&args->log.usim_hex_limit), "USIM log hex dump limit")
("log.all_level", bpo::value<string>(&args->log.all_level)->default_value("info"), "ALL log level")
("log.all_hex_limit", bpo::value<int>(&args->log.all_hex_limit)->default_value(32), "ALL log hex dump limit")

@ -32,6 +32,7 @@
#include <string>
#include <algorithm>
#include <iterator>
#include <ue_base.h>
using namespace srslte;
@ -52,31 +53,33 @@ bool ue::init(all_args_t *args_)
{
args = args_;
#ifndef LOG_STDOUT
logger.init(args->log.filename);
#endif
rf_log.init("RF ", &logger);
if (!args->log.filename.compare("stdout")) {
logger = &logger_stdout;
} else {
logger_file.init(args->log.filename);
logger_file.log("\n\n");
logger = &logger_file;
}
rf_log.init("RF ", logger);
// Create array of pointers to phy_logs
for (int i=0;i<args->expert.phy.nof_phy_threads;i++) {
srslte::log_filter *mylog = new srslte::log_filter;
char tmp[16];
sprintf(tmp, "PHY%d",i);
mylog->init(tmp, &logger, true);
mylog->init(tmp, logger, true);
phy_log.push_back((void*) mylog);
}
mac_log.init("MAC ", &logger, true);
rlc_log.init("RLC ", &logger);
pdcp_log.init("PDCP", &logger);
rrc_log.init("RRC ", &logger);
nas_log.init("NAS ", &logger);
gw_log.init("GW ", &logger);
usim_log.init("USIM", &logger);
mac_log.init("MAC ", logger, true);
rlc_log.init("RLC ", logger);
pdcp_log.init("PDCP", logger);
rrc_log.init("RRC ", logger);
nas_log.init("NAS ", logger);
gw_log.init("GW ", logger);
usim_log.init("USIM", logger);
// Init logs
#ifndef LOG_STDOUT
logger.log("\n\n");
#endif
rf_log.set_level(srslte::LOG_LEVEL_INFO);
for (int i=0;i<args->expert.phy.nof_phy_threads;i++) {
((srslte::log_filter*) phy_log[i])->set_level(level(args->log.phy_level));

@ -64,7 +64,8 @@ filename = /tmp/ue.pcap
# Logging layers: phy, mac, rlc, pdcp, rrc, nas, gw, usim, all
# Logging levels: debug, info, warning, error, none
#
# filename: File path to use for log output
# filename: File path to use for log output. Can be set to stdout
# to print logs to standard output
#####################################################################
[log]
all_level = info

Loading…
Cancel
Save