mirror of https://github.com/PentHertz/srsLTE.git
expose debug_long to class log and use in RRC to log ASN1 structs
This commit is contained in:
parent
7dde4f3b8a
commit
57317fab7c
|
@ -134,6 +134,7 @@ public:
|
||||||
virtual void warning(const char * message, ...) __attribute__ ((format (printf, 2, 3))) = 0;
|
virtual void warning(const char * message, ...) __attribute__ ((format (printf, 2, 3))) = 0;
|
||||||
virtual void info(const char * message, ...) __attribute__ ((format (printf, 2, 3))) = 0;
|
virtual void info(const char * message, ...) __attribute__ ((format (printf, 2, 3))) = 0;
|
||||||
virtual void debug(const char * message, ...) __attribute__ ((format (printf, 2, 3))) = 0;
|
virtual void debug(const char * message, ...) __attribute__ ((format (printf, 2, 3))) = 0;
|
||||||
|
virtual void debug_long(const char* message, ...) __attribute__((format(printf, 2, 3))) = 0;
|
||||||
|
|
||||||
// Same with hex dump
|
// Same with hex dump
|
||||||
virtual void error_hex(const uint8_t *, int, const char *, ...) __attribute__((format (printf, 4, 5)))
|
virtual void error_hex(const uint8_t *, int, const char *, ...) __attribute__((format (printf, 4, 5)))
|
||||||
|
|
|
@ -68,15 +68,15 @@ void log_filter::init(std::string layer, logger *logger_, bool tti)
|
||||||
void log_filter::all_log(
|
void log_filter::all_log(
|
||||||
srslte::LOG_LEVEL_ENUM level, uint32_t tti, const char* msg, const uint8_t* hex, int size, bool long_msg)
|
srslte::LOG_LEVEL_ENUM level, uint32_t tti, const char* msg, const uint8_t* hex, int size, bool long_msg)
|
||||||
{
|
{
|
||||||
char buffer_tti[16];
|
char buffer_tti[16] = {};
|
||||||
char buffer_time[64];
|
char buffer_time[64] = {};
|
||||||
|
|
||||||
if (logger_h) {
|
if (logger_h) {
|
||||||
logger::unique_log_str_t log_str = nullptr;
|
logger::unique_log_str_t log_str = nullptr;
|
||||||
|
|
||||||
if (long_msg) {
|
if (long_msg) {
|
||||||
// For long messages, dynamically allocate a new log_str with enough size outside the pool.
|
// For long messages, dynamically allocate a new log_str with enough size outside the pool.
|
||||||
uint32_t log_str_msg_len = sizeof(buffer_tti) + sizeof(buffer_time) + 10 + strlen(msg);
|
uint32_t log_str_msg_len = sizeof(buffer_tti) + sizeof(buffer_time) + 20 + size;
|
||||||
log_str = logger::unique_log_str_t(new logger::log_str(nullptr, log_str_msg_len), logger::log_str_deleter());
|
log_str = logger::unique_log_str_t(new logger::log_str(nullptr, log_str_msg_len), logger::log_str_deleter());
|
||||||
} else {
|
} else {
|
||||||
log_str = logger_h->allocate_unique_log_str();
|
log_str = logger_h->allocate_unique_log_str();
|
||||||
|
@ -164,7 +164,7 @@ void log_filter::debug_long(const char* message, ...)
|
||||||
va_list args;
|
va_list args;
|
||||||
va_start(args, message);
|
va_start(args, message);
|
||||||
if (vasprintf(&args_msg, message, args) > 0)
|
if (vasprintf(&args_msg, message, args) > 0)
|
||||||
all_log(LOG_LEVEL_ERROR, tti, args_msg);
|
all_log(LOG_LEVEL_DEBUG, tti, args_msg, nullptr, strlen(args_msg), true);
|
||||||
va_end(args);
|
va_end(args);
|
||||||
free(args_msg);
|
free(args_msg);
|
||||||
}
|
}
|
||||||
|
|
|
@ -107,7 +107,7 @@ void rrc::log_rrc_message(const std::string source, const direction_t dir, const
|
||||||
msg.to_json(json_writer);
|
msg.to_json(json_writer);
|
||||||
rrc_log->debug_hex(pdu->msg, pdu->N_bytes, "%s - %s %s (%d B)\n", source.c_str(), (dir == Rx) ? "Rx" : "Tx",
|
rrc_log->debug_hex(pdu->msg, pdu->N_bytes, "%s - %s %s (%d B)\n", source.c_str(), (dir == Rx) ? "Rx" : "Tx",
|
||||||
msg.msg.c1().type().to_string().c_str(), pdu->N_bytes);
|
msg.msg.c1().type().to_string().c_str(), pdu->N_bytes);
|
||||||
rrc_log->debug("Content:\n%s\n", json_writer.to_string().c_str());
|
rrc_log->debug_long("Content:\n%s\n", json_writer.to_string().c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue