Commit d22b51bf authored by Raphael Defosseux's avatar Raphael Defosseux

Merge branch 'flexible-logging-level' into 'develop'

feat(smf): adding a flexible log-level

See merge request oai/cn5g/oai-cn5g-smf!188
parents 5b33bae9 6ab4daf2
......@@ -24,6 +24,7 @@ SMF =
FQDN = "oai-smf-svc";
INSTANCE = {{ env["INSTANCE"] if "INSTANCE" in env.keys() else 0 }}; # 0 is the default
PID_DIRECTORY = "{{ env["PID_DIRECTORY"] if "PID_DIRECTORY" in env.keys() else '/var/run' }}"; # /var/run is the default
LOG_LEVEL = "{{ env["LOG_LEVEL"] if "LOG_LEVEL" in env.keys() else 'debug' }}";
INTERFACES :
{
......
......@@ -73,6 +73,12 @@ class Logger {
oai::logger::logger_registry::register_logger(
name, ASYNC, log_stdout, log_rot_file);
}
static void set_level(spdlog::level::level_enum level) {
oai::logger::logger_registry::set_level(level);
}
static bool should_log(spdlog::level::level_enum level) {
return oai::logger::logger_registry::should_log(level);
}
static const oai::logger::printf_logger& smf_app() {
return oai::logger::logger_registry::get_logger(SMF_APP);
......@@ -120,5 +126,4 @@ class Logger {
static const oai::logger::printf_logger& async_cmd() {
return oai::logger::logger_registry::get_logger(ASYNC);
}
};
\ No newline at end of file
};
......@@ -63,11 +63,7 @@
} \
} while (0)
#if DEBUG_IS_ON
#define _ASSERT_FINAL_ _Assert_SegFault_
#else
#define _ASSERT_FINAL_ _Assert_Exit_
#endif
#define AssertFatal(cOND, ...) _Assert_(cOND, _ASSERT_FINAL_, ##__VA_ARGS__)
#define DevCheck(cOND, vALUE1, vALUE2, vALUE3) \
......
......@@ -236,13 +236,14 @@ void conv::convert_string_2_hex(
memset(data, 0, input_str.length() + 1);
memcpy((void*) data, (void*) input_str.c_str(), input_str.length());
#if DEBUG_IS_ON
Logger::smf_app().debug("Input: ");
for (int i = 0; i < input_str.length(); i++) {
printf("%02x ", data[i]);
if (Logger::should_log(spdlog::level::debug)) {
for (int i = 0; i < input_str.length(); i++) {
printf("%02x ", data[i]);
}
printf("\n");
}
printf("\n");
#endif
char* datahex = (char*) malloc(input_str.length() * 2 + 1);
memset(datahex, 0, input_str.length() * 2 + 1);
......
......@@ -91,10 +91,10 @@ unsigned char* mime_parser::format_string_as_hex(const std::string& str) {
Logger::smf_app().debug("Input string (%d bytes): %s ", str_len, str.c_str());
Logger::smf_app().debug("Data (formatted):");
#if DEBUG_IS_ON
for (int i = 0; i < str_len / 2; i++) printf(" %02x ", data_hex[i]);
printf("\n");
#endif
if (Logger::should_log(spdlog::level::debug)) {
for (int i = 0; i < str_len / 2; i++) printf(" %02x ", data_hex[i]);
printf("\n");
}
// free memory
// free_wrapper((void**) &data);
free(data);
......
......@@ -336,7 +336,6 @@ static int _nas_message_header_encode(
unsigned char* buffer, const nas_message_security_header_t* header,
size_t length) {
int size = 0;
/*
* Encode the first octet of the header (security header type or EPS bearer
* identity, and protocol discriminator)
......@@ -346,17 +345,10 @@ static int _nas_message_header_encode(
// Security header type associated with a spare half octet;
ENCODE_U8(buffer + size, *((uint8_t*) (header) + 1), size);
// ENCODE_U8 (buffer+size,header->security_header_type,size);
#if DEBUG_IS_ON
printf(
"extended_protocol_discriminator %d, security_header_type %d \n",
header->extended_protocol_discriminator, header->security_header_type);
#endif
if (header->extended_protocol_discriminator ==
EPD_5GS_MOBILITY_MANAGEMENT_MESSAGES) {
if (header->security_header_type != SECURITY_HEADER_TYPE_NOT_PROTECTED) {
#if DEBUG_IS_ON
printf("security_header_type != SECURITY_HEADER_TYPE_NOT_PROTECTED\n");
#endif
if (length < NAS_MESSAGE_SECURITY_HEADER_SIZE) {
/*
* The buffer is not big enough to contain security header
......@@ -373,11 +365,7 @@ static int _nas_message_header_encode(
*/
ENCODE_U8(buffer + size, header->sequence_number, size);
}
#if DEBUG_IS_ON
printf("security_header_type: SECURITY_HEADER_TYPE_NOT_PROTECTED\n");
#endif
}
return size;
}
static int _nas_message_protected_encode(
......
......@@ -207,9 +207,7 @@ int encode_pdu_session_establishment_accept(
uint8_t* buffer, uint32_t len) {
uint32_t encoded = 0;
int encoded_result = 0;
#if DEBUG_IS_ON
printf("\nEncode PDU Session Establishment Accept\n");
#endif
// Check if we got a NULL pointer and if buffer length is >= minimum length
// expected for the message.
CHECK_PDU_POINTER_AND_LENGTH_ENCODER(
......
......@@ -159,9 +159,7 @@ int fivegsm_msg_encode(SM_msg* msg, uint8_t* buffer, uint32_t len) {
buffer += header_result;
len -= header_result;
#if DEBUG_IS_ON
printf("message type %d", msg->header.message_type);
#endif
switch (msg->header.message_type) {
case PDU_SESSION_ESTABLISHMENT_REQUEST:
encode_result = encode_pdu_session_establishment_request(
......
oai-cn5g-common-src @ db83907f
Subproject commit 12e0a3977f4ae1672543075e523f0ec9b0a75bf4
Subproject commit db83907f0edcfcb4a9b189decedfd00fa01f98aa
......@@ -159,21 +159,21 @@ add_definitions(-DBSTRLIB_CAN_USE_STL=1 -DBSTRLIB_CAN_USE_IOSTREAM=1 -DBSTRLIB_T
if(STATIC_LINKING)
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS} -g -fstack-protector-all -DMALLOC_CHECK_=3 -DINFO_IS_ON=1 -DDEBUG_IS_ON=1 -DTRACE_IS_ON=1 -O0 -fno-omit-frame-pointer")
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS} -g -fstack-protector-all -DMALLOC_CHECK_=3 -O0 -fno-omit-frame-pointer")
else (STATIC_LINKING)
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS} -g -fstack-protector-all -DMALLOC_CHECK_=3 -DINFO_IS_ON=1 -DDEBUG_IS_ON=1 -DTRACE_IS_ON=1 -O0 -fsanitize=address -fno-omit-frame-pointer")
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS} -g -fstack-protector-all -DMALLOC_CHECK_=3 -O0 -fsanitize=address -fno-omit-frame-pointer")
endif(STATIC_LINKING)
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS} -O2 -fno-omit-frame-pointer -s -DINFO_IS_ON=1 -DDEBUG_IS_ON=1 ")
set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS} -g -O2 -DINFO_IS_ON=1 ")
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS} -O2 -fno-omit-frame-pointer -s ")
set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS} -g -O2 ")
set(CMAKE_C_FLAGS_MINSIZEREL "${CMAKE_C_FLAGS} -Os -s")
if(STATIC_LINKING)
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS} -std=c++17 -g -fstack-protector-all -DMALLOC_CHECK_=3 -DINFO_IS_ON=1 -DDEBUG_IS_ON=1 -DTRACE_IS_ON=1 -O0 -fno-omit-frame-pointer")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS} -std=c++17 -g -fstack-protector-all -DMALLOC_CHECK_=3 -O0 -fno-omit-frame-pointer")
else(STATIC_LINKING)
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS} -std=c++17 -g -fstack-protector-all -DMALLOC_CHECK_=3 -DINFO_IS_ON=1 -DDEBUG_IS_ON=1 -DTRACE_IS_ON=1 -O0 -fsanitize=address -fno-omit-frame-pointer")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS} -std=c++17 -g -fstack-protector-all -DMALLOC_CHECK_=3 -O0 -fsanitize=address -fno-omit-frame-pointer")
endif(STATIC_LINKING)
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS} -std=c++17 -O2 -fno-omit-frame-pointer -s -DINFO_IS_ON=1 -DDEBUG_IS_ON=1")
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS} -std=c++17 -g -O2 -DINFO_IS_ON=1")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS} -std=c++17 -O2 -fno-omit-frame-pointer -s ")
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS} -std=c++17 -g -O2 ")
set(CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS} -std=c++17 -Os -s")
......
......@@ -110,6 +110,7 @@ int main(int argc, char** argv) {
// Config
smf_cfg.load(Options::getlibconfigConfig());
smf_cfg.display();
Logger::set_level(smf_cfg.log_level);
// Inter-task Interface
itti_inst = new itti_mw();
......
......@@ -254,6 +254,16 @@ int smf_config::load(const string& config_file) {
"%s : %s, using defaults", nfex.what(), nfex.getPath());
}
// Log Level
try {
std::string string_level;
smf_cfg.lookupValue(SMF_CONFIG_STRING_LOG_LEVEL, string_level);
log_level = spdlog::level::from_str(string_level);
} catch (const SettingNotFoundException& nfex) {
Logger::smf_app().error(
"%s : %s, using defaults", nfex.what(), nfex.getPath());
}
// FQDN
try {
smf_cfg.lookupValue(SMF_CONFIG_STRING_FQDN_DNS, fqdn);
......@@ -1176,6 +1186,9 @@ void smf_config::display() {
index++;
}
}
Logger::smf_app().info(
"- Log Level will be .......: %s",
spdlog::level::to_string_view(log_level));
}
//------------------------------------------------------------------------------
......@@ -1281,4 +1294,4 @@ std::string smf_config::get_nwi(
}
}
return "";
}
\ No newline at end of file
}
......@@ -166,6 +166,8 @@
#define SMF_MAX_ALLOCATED_PDN_ADDRESSES 1024
#define SMF_CONFIG_STRING_LOG_LEVEL "LOG_LEVEL"
namespace smf {
typedef struct interface_cfg_s {
......@@ -220,6 +222,7 @@ class smf_config {
/* Reader/writer lock for this configuration */
std::mutex m_rw_lock;
std::string pid_dir;
spdlog::level::level_enum log_level;
unsigned int instance = 0;
std::string fqdn = {};
......
......@@ -268,11 +268,11 @@ bool smf_n1::create_n1_pdu_session_establishment_accept(
bytes = nas_message_encode(
data, &nas_msg, sizeof(data) /*don't know the size*/, nullptr);
#if DEBUG_IS_ON
Logger::smf_n1().debug("Buffer Data: ");
for (int i = 0; i < bytes; i++) printf("%02x ", data[i]);
printf(" (bytes %d)\n", bytes);
#endif
if (Logger::should_log(spdlog::level::debug)) {
for (int i = 0; i < bytes; i++) printf("%02x ", data[i]);
printf(" (bytes %d)\n", bytes);
}
if (bytes > 0) {
std::string n1Message((char*) data, bytes);
......@@ -367,11 +367,11 @@ bool smf_n1::create_n1_pdu_session_establishment_reject(
bytes = nas_message_encode(
data, &nas_msg, sizeof(data) /*don't know the size*/, nullptr);
#if DEBUG_IS_ON
Logger::smf_n1().debug("Buffer Data: ");
for (int i = 0; i < bytes; i++) printf("%02x ", data[i]);
printf(" (bytes %d)\n", bytes);
#endif
if (Logger::should_log(spdlog::level::debug)) {
for (int i = 0; i < bytes; i++) printf("%02x ", data[i]);
printf(" (bytes %d)\n", bytes);
}
if (bytes > 0) {
std::string n1Message((char*) data, bytes);
......@@ -503,11 +503,11 @@ bool smf_n1::create_n1_pdu_session_modification_command(
bytes = nas_message_encode(
data, &nas_msg, sizeof(data) /*don't know the size*/, nullptr);
#if DEBUG_IS_ON
Logger::smf_n1().debug("Buffer Data: ");
for (int i = 0; i < bytes; i++) printf("%02x ", data[i]);
printf(" (bytes %d)\n", bytes);
#endif
if (Logger::should_log(spdlog::level::debug)) {
for (int i = 0; i < bytes; i++) printf("%02x ", data[i]);
printf(" (bytes %d)\n", bytes);
}
if (bytes > 0) {
std::string n1Message((char*) data, bytes);
......@@ -645,11 +645,11 @@ bool smf_n1::create_n1_pdu_session_modification_command(
bytes = nas_message_encode(
data, &nas_msg, sizeof(data) /*don't know the size*/, nullptr);
#if DEBUG_IS_ON
Logger::smf_n1().debug("Buffer Data: ");
for (int i = 0; i < bytes; i++) printf("%02x ", data[i]);
printf(" (bytes %d)\n", bytes);
#endif
if (Logger::should_log(spdlog::level::debug)) {
for (int i = 0; i < bytes; i++) printf("%02x ", data[i]);
printf(" (bytes %d)\n", bytes);
}
if (bytes > 0) {
std::string n1Message((char*) data, bytes);
......@@ -702,11 +702,11 @@ bool smf_n1::create_n1_pdu_session_release_reject(
bytes = nas_message_encode(
data, &nas_msg, sizeof(data) /*don't know the size*/, nullptr);
#if DEBUG_IS_ON
Logger::smf_n1().debug("Buffer Data: ");
for (int i = 0; i < bytes; i++) printf("%02x ", data[i]);
printf(" (bytes %d)\n", bytes);
#endif
if (Logger::should_log(spdlog::level::debug)) {
for (int i = 0; i < bytes; i++) printf("%02x ", data[i]);
printf(" (bytes %d)\n", bytes);
}
if (bytes > 0) {
std::string n1Message((char*) data, bytes);
......@@ -771,11 +771,11 @@ bool smf_n1::create_n1_pdu_session_release_command(
bytes = nas_message_encode(
data, &nas_msg, sizeof(data) /*don't know the size*/, nullptr);
#if DEBUG_IS_ON
Logger::smf_n1().debug("Buffer Data: ");
for (int i = 0; i < bytes; i++) printf("%02x ", data[i]);
printf(" (bytes %d)\n", bytes);
#endif
if (Logger::should_log(spdlog::level::debug)) {
for (int i = 0; i < bytes; i++) printf("%02x ", data[i]);
printf(" (bytes %d)\n", bytes);
}
if (bytes > 0) {
std::string n1Message((char*) data, bytes);
......@@ -838,11 +838,11 @@ bool smf_n1::create_n1_pdu_session_release_command(
bytes = nas_message_encode(
data, &nas_msg, sizeof(data) /*don't know the size*/, nullptr);
#if DEBUG_IS_ON
Logger::smf_n1().debug("Buffer Data: ");
for (int i = 0; i < bytes; i++) printf("%02x ", data[i]);
printf(" (bytes %d)\n", bytes);
#endif
if (Logger::should_log(spdlog::level::debug)) {
for (int i = 0; i < bytes; i++) printf("%02x ", data[i]);
printf(" (bytes %d)\n", bytes);
}
if (bytes > 0) {
std::string n1Message((char*) data, bytes);
......@@ -878,11 +878,11 @@ int smf_n1::decode_n1_sm_container(
memset(data, 0, data_len + 1);
memcpy((void*) data, (void*) n1_sm_msg.c_str(), data_len);
#if DEBUG_IS_ON
printf("Content: ");
for (int i = 0; i < data_len; i++) printf(" %02x ", data[i]);
printf("\n");
#endif
if (Logger::should_log(spdlog::level::debug)) {
printf("Content: ");
for (int i = 0; i < data_len; i++) printf(" %02x ", data[i]);
printf("\n");
}
// decode the NAS message
decoder_rc =
......
......@@ -283,11 +283,11 @@ bool smf_n2::create_n2_pdu_session_resource_setup_request_transfer(
encoded_size);
result = false;
} else {
#if DEBUG_IS_ON
Logger::smf_n2().debug("N2 SM buffer data: ");
for (int i = 0; i < encoded_size; i++) printf("%02x ", (char) buffer[i]);
printf(" (%d bytes)\n", (int) encoded_size);
#endif
if (Logger::should_log(spdlog::level::debug)) {
for (int i = 0; i < encoded_size; i++) printf("%02x ", (char) buffer[i]);
printf(" (%d bytes)\n", (int) encoded_size);
}
std::string ngap_message((char*) buffer, encoded_size);
ngap_msg_str = ngap_message;
......@@ -546,11 +546,11 @@ bool smf_n2::create_n2_pdu_session_resource_setup_request_transfer(
encoded_size);
result = false;
} else {
#if DEBUG_IS_ON
Logger::smf_n2().debug("N2 SM buffer data: ");
for (int i = 0; i < encoded_size; i++) printf("%02x ", (char) buffer[i]);
printf(" (%d bytes)\n", (int) encoded_size);
#endif
if (Logger::should_log(spdlog::level::debug)) {
for (int i = 0; i < encoded_size; i++) printf("%02x ", (char) buffer[i]);
printf(" (%d bytes)\n", (int) encoded_size);
}
std::string ngap_message((char*) buffer, encoded_size);
ngap_msg_str = ngap_message;
......@@ -809,11 +809,11 @@ bool smf_n2::create_n2_pdu_session_resource_modify_request_transfer(
encoded_size);
result = false;
} else {
#if DEBUG_IS_ON
Logger::smf_n2().debug("N2 SM buffer data: ");
for (int i = 0; i < encoded_size; i++) printf("%02x ", (char) buffer[i]);
printf(" (%d bytes)\n", (int) encoded_size);
#endif
if (Logger::should_log(spdlog::level::debug)) {
for (int i = 0; i < encoded_size; i++) printf("%02x ", (char) buffer[i]);
printf(" (%d bytes)\n", (int) encoded_size);
}
std::string ngap_message((char*) buffer, encoded_size);
ngap_msg_str = ngap_message;
......@@ -877,11 +877,11 @@ bool smf_n2::create_n2_pdu_session_resource_release_command_transfer(
encoded_size);
result = false;
} else {
#if DEBUG_IS_ON
Logger::smf_n2().debug("N2 SM buffer data: ");
for (int i = 0; i < encoded_size; i++) printf("%02x ", (char) buffer[i]);
Logger::smf_n2().debug(" (%d bytes) \n", encoded_size);
#endif
if (Logger::should_log(spdlog::level::debug)) {
for (int i = 0; i < encoded_size; i++) printf("%02x ", (char) buffer[i]);
Logger::smf_n2().debug(" (%d bytes) \n", encoded_size);
}
std::string ngap_message((char*) buffer, encoded_size);
ngap_msg_str = ngap_message;
......@@ -926,11 +926,11 @@ bool smf_n2::create_n2_pdu_session_resource_release_command_transfer(
encoded_size);
result = false;
} else {
#if DEBUG_IS_ON
Logger::smf_n2().debug("N2 SM buffer data: ");
for (int i = 0; i < encoded_size; i++) printf("%02x ", (char) buffer[i]);
Logger::smf_n2().debug(" (%d bytes) \n", encoded_size);
#endif
if (Logger::should_log(spdlog::level::debug)) {
for (int i = 0; i < encoded_size; i++) printf("%02x ", (char) buffer[i]);
Logger::smf_n2().debug(" (%d bytes) \n", encoded_size);
}
std::string ngap_message((char*) buffer, encoded_size);
ngap_msg_str = ngap_message;
......@@ -1045,11 +1045,11 @@ bool smf_n2::create_n2_pdu_session_resource_modify_response_transfer(
encoded_size);
result = false;
} else {
#if DEBUG_IS_ON
Logger::smf_n2().debug("N2 SM buffer data: ");
for (int i = 0; i < encoded_size; i++) printf("%02x ", (char) buffer[i]);
Logger::smf_n2().debug(" (%d bytes) \n", encoded_size);
#endif
if (Logger::should_log(spdlog::level::debug)) {
for (int i = 0; i < encoded_size; i++) printf("%02x ", (char) buffer[i]);
Logger::smf_n2().debug(" (%d bytes) \n", encoded_size);
}
std::string ngap_message((char*) buffer, encoded_size);
ngap_msg_str = ngap_message;
......@@ -1153,11 +1153,11 @@ bool smf_n2::create_n2_path_switch_request_ack(
encoded_size);
result = false;
} else {
#if DEBUG_IS_ON
Logger::smf_n2().debug("N2 SM buffer data: ");
for (int i = 0; i < encoded_size; i++) printf("%02x ", (char) buffer[i]);
Logger::smf_n2().debug(" (%d bytes) \n", encoded_size);
#endif
if (Logger::should_log(spdlog::level::debug)) {
for (int i = 0; i < encoded_size; i++) printf("%02x ", (char) buffer[i]);
Logger::smf_n2().debug(" (%d bytes) \n", encoded_size);
}
std::string ngap_message((char*) buffer, encoded_size);
ngap_msg_str = ngap_message;
......@@ -1256,11 +1256,11 @@ bool smf_n2::create_n2_handover_command_transfer(
encoded_size);
result = false;
} else {
#if DEBUG_IS_ON
Logger::smf_n2().debug("N2 SM buffer data: ");
for (int i = 0; i < encoded_size; i++) printf("%02x ", (char) buffer[i]);
Logger::smf_n2().debug(" (%d bytes) \n", encoded_size);
#endif
if (Logger::should_log(spdlog::level::debug)) {
for (int i = 0; i < encoded_size; i++) printf("%02x ", (char) buffer[i]);
Logger::smf_n2().debug(" (%d bytes) \n", encoded_size);
}
std::string ngap_message((char*) buffer, encoded_size);
ngap_msg_str = ngap_message;
......@@ -1314,11 +1314,11 @@ bool smf_n2::create_n2_handover_preparation_unsuccessful_transfer(
encoded_size);
result = false;
} else {
#if DEBUG_IS_ON
Logger::smf_n2().debug("N2 SM buffer data: ");
for (int i = 0; i < encoded_size; i++) printf("%02x ", (char) buffer[i]);
Logger::smf_n2().debug(" (%d bytes) \n", encoded_size);
#endif
if (Logger::should_log(spdlog::level::debug)) {
for (int i = 0; i < encoded_size; i++) printf("%02x ", (char) buffer[i]);
Logger::smf_n2().debug(" (%d bytes) \n", encoded_size);
}
std::string ngap_message((char*) buffer, encoded_size);
ngap_msg_str = ngap_message;
......@@ -1343,11 +1343,11 @@ int smf_n2::decode_n2_sm_information(
memset(data, 0, data_len + 1);
memcpy((void*) data, (void*) n2_sm_info.c_str(), data_len);
#if DEBUG_IS_ON
printf("Content: ");
for (int i = 0; i < data_len; i++) printf(" %02x ", data[i]);
printf("\n");
#endif
if (Logger::should_log(spdlog::level::debug)) {
printf("Content: ");
for (int i = 0; i < data_len; i++) printf(" %02x ", data[i]);
printf("\n");
}
// PDUSessionResourceSetupResponseTransfer
asn_dec_rval_t rc = asn_decode(
......
......@@ -1111,7 +1111,6 @@ bool smf_sbi::curl_create_handle(
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(curl, CURLOPT_URL, uri.c_str());
// curl_easy_setopt(curl, CURLOPT_VERBOSE, 0L);
curl_easy_setopt(curl, CURLOPT_PRIVATE, promise_id);
if (method.compare("POST") == 0)
curl_easy_setopt(curl, CURLOPT_POST, 1);
......@@ -1126,7 +1125,8 @@ bool smf_sbi::curl_create_handle(
curl_easy_setopt(curl, CURLOPT_INTERFACE, smf_cfg.sbi.if_name.c_str());
if (http_version == 2) {
curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L);
if (Logger::should_log(spdlog::level::debug))
curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L);
// We use a self-signed test server, skip verification during debugging
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0L);
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 0L);
......@@ -1171,7 +1171,6 @@ bool smf_sbi::curl_create_handle(
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(curl, CURLOPT_URL, uri.c_str());
// curl_easy_setopt(curl, CURLOPT_VERBOSE, 0L);
curl_easy_setopt(curl, CURLOPT_PRIVATE, promise_id);
if (method.compare("POST") == 0)
......@@ -1187,7 +1186,8 @@ bool smf_sbi::curl_create_handle(
curl_easy_setopt(curl, CURLOPT_INTERFACE, smf_cfg.sbi.if_name.c_str());
if (http_version == 2) {
curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L);
if (Logger::should_log(spdlog::level::debug))
curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L);
// We use a self-signed test server, skip verification during debugging
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0L);
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 0L);
......@@ -1235,7 +1235,6 @@ bool smf_sbi::curl_create_handle(
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(curl, CURLOPT_URL, uri.c_str());
// curl_easy_setopt(curl, CURLOPT_VERBOSE, 0L);
curl_easy_setopt(curl, CURLOPT_PRIVATE, promise_id);
if (method.compare("POST") == 0)
......@@ -1251,7 +1250,8 @@ bool smf_sbi::curl_create_handle(
curl_easy_setopt(curl, CURLOPT_INTERFACE, smf_cfg.sbi.if_name.c_str());
if (http_version == 2) {
curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L);
if (Logger::should_log(spdlog::level::debug))
curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L);
// We use a self-signed test server, skip verification during debugging
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0L);
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 0L);
......@@ -1297,7 +1297,6 @@ bool smf_sbi::curl_create_handle(
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(curl, CURLOPT_URL, uri.c_str());
// curl_easy_setopt(curl, CURLOPT_VERBOSE, 0L);
curl_easy_setopt(curl, CURLOPT_PRIVATE, promise_id);
if (method.compare("DELETE") == 0)
......@@ -1309,7 +1308,8 @@ bool smf_sbi::curl_create_handle(
curl_easy_setopt(curl, CURLOPT_INTERFACE, smf_cfg.sbi.if_name.c_str());
if (http_version == 2) {
curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L);
if (Logger::should_log(spdlog::level::debug))
curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L);
// We use a self-signed test server, skip verification during debugging
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0L);
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 0L);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment