Browse Source

Replace `info` macro with a less generic name (#15266)

Carlo Cabrera 1 year ago
parent
commit
5b56f09dbc

+ 17 - 17
aclk/aclk.c

@@ -154,7 +154,7 @@ biofailed:
 
 static int wait_till_cloud_enabled()
 {
-    info("Waiting for Cloud to be enabled");
+    netdata_log_info("Waiting for Cloud to be enabled");
     while (!netdata_cloud_enabled) {
         sleep_usec(USEC_PER_SEC * 1);
         if (!service_running(SERVICE_ACLK))
@@ -237,7 +237,7 @@ void aclk_mqtt_wss_log_cb(mqtt_wss_log_type_t log_type, const char* str)
             error_report("%s", str);
             return;
         case MQTT_WSS_LOG_INFO:
-            info("%s", str);
+            netdata_log_info("%s", str);
             return;
         case MQTT_WSS_LOG_DEBUG:
             debug(D_ACLK, "%s", str);
@@ -297,7 +297,7 @@ static void puback_callback(uint16_t packet_id)
 #endif
 
     if (aclk_shared_state.mqtt_shutdown_msg_id == (int)packet_id) {
-        info("Shutdown message has been acknowledged by the cloud. Exiting gracefully");
+        netdata_log_info("Shutdown message has been acknowledged by the cloud. Exiting gracefully");
         aclk_shared_state.mqtt_shutdown_msg_rcvd = 1;
     }
 }
@@ -335,7 +335,7 @@ static int handle_connection(mqtt_wss_client client)
         }
 
         if (disconnect_req || aclk_kill_link) {
-            info("Going to restart connection due to disconnect_req=%s (cloud req), aclk_kill_link=%s (reclaim)",
+            netdata_log_info("Going to restart connection due to disconnect_req=%s (cloud req), aclk_kill_link=%s (reclaim)",
                 disconnect_req ? "true" : "false",
                 aclk_kill_link ? "true" : "false");
             disconnect_req = 0;
@@ -390,7 +390,7 @@ static inline void mqtt_connected_actions(mqtt_wss_client client)
 
 void aclk_graceful_disconnect(mqtt_wss_client client)
 {
-    info("Preparing to gracefully shutdown ACLK connection");
+    netdata_log_info("Preparing to gracefully shutdown ACLK connection");
     aclk_queue_lock();
     aclk_queue_flush();
 
@@ -403,17 +403,17 @@ void aclk_graceful_disconnect(mqtt_wss_client client)
             break;
         }
         if (aclk_shared_state.mqtt_shutdown_msg_rcvd) {
-            info("MQTT App Layer `disconnect` message sent successfully");
+            netdata_log_info("MQTT App Layer `disconnect` message sent successfully");
             break;
         }
     }
-    info("ACLK link is down");
+    netdata_log_info("ACLK link is down");
     log_access("ACLK DISCONNECTED");
     aclk_stats_upd_online(0);
     last_disconnect_time = now_realtime_sec();
     aclk_connected = 0;
 
-    info("Attempting to gracefully shutdown the MQTT/WSS connection");
+    netdata_log_info("Attempting to gracefully shutdown the MQTT/WSS connection");
     mqtt_wss_disconnect(client, 1000);
 }
 
@@ -455,7 +455,7 @@ static int aclk_block_till_recon_allowed() {
     next_connection_attempt = now_realtime_sec() + (recon_delay / MSEC_PER_SEC);
     last_backoff_value = (float)recon_delay / MSEC_PER_SEC;
 
-    info("Wait before attempting to reconnect in %.3f seconds", recon_delay / (float)MSEC_PER_SEC);
+    netdata_log_info("Wait before attempting to reconnect in %.3f seconds", recon_delay / (float)MSEC_PER_SEC);
     // we want to wake up from time to time to check netdata_exit
     while (recon_delay)
     {
@@ -593,7 +593,7 @@ static int aclk_attempt_to_connect(mqtt_wss_client client)
             return 1;
         }
 
-        info("Attempting connection now");
+        netdata_log_info("Attempting connection now");
         memset(&base_url, 0, sizeof(url_t));
         if (url_parse(aclk_cloud_base_url, &base_url)) {
             aclk_status = ACLK_STATUS_INVALID_CLOUD_URL;
@@ -680,7 +680,7 @@ static int aclk_attempt_to_connect(mqtt_wss_client client)
             error_report("Can't use encoding=proto without at least \"proto\" capability.");
             continue;
         }
-        info("New ACLK protobuf protocol negotiated successfully (/env response).");
+        netdata_log_info("New ACLK protobuf protocol negotiated successfully (/env response).");
 
         memset(&auth_url, 0, sizeof(url_t));
         if (url_parse(aclk_env->auth_endpoint, &auth_url)) {
@@ -750,7 +750,7 @@ static int aclk_attempt_to_connect(mqtt_wss_client client)
 
         if (!ret) {
             last_conn_time_mqtt = now_realtime_sec();
-            info("ACLK connection successfully established");
+            netdata_log_info("ACLK connection successfully established");
             aclk_status = ACLK_STATUS_CONNECTED;
             log_access("ACLK CONNECTED");
             mqtt_connected_actions(client);
@@ -798,7 +798,7 @@ void *aclk_main(void *ptr)
     netdata_thread_disable_cancelability();
 
 #if defined( DISABLE_CLOUD ) || !defined( ENABLE_ACLK )
-    info("Killing ACLK thread -> cloud functionality has been disabled");
+    netdata_log_info("Killing ACLK thread -> cloud functionality has been disabled");
     static_thread->enabled = NETDATA_MAIN_THREAD_EXITED;
     return NULL;
 #endif
@@ -924,7 +924,7 @@ void aclk_host_state_update(RRDHOST *host, int cmd)
             rrdhost_aclk_state_unlock(localhost);
             create_query->data.bin_payload.topic = ACLK_TOPICID_CREATE_NODE;
             create_query->data.bin_payload.msg_name = "CreateNodeInstance";
-            info("Registering host=%s, hops=%u", host->machine_guid, host->system_info->hops);
+            netdata_log_info("Registering host=%s, hops=%u", host->machine_guid, host->system_info->hops);
             aclk_queue_query(create_query);
             return;
         }
@@ -947,7 +947,7 @@ void aclk_host_state_update(RRDHOST *host, int cmd)
     query->data.bin_payload.payload = generate_node_instance_connection(&query->data.bin_payload.size, &node_state_update);
     rrdhost_aclk_state_unlock(localhost);
 
-    info("Queuing status update for node=%s, live=%d, hops=%u",(char*)node_state_update.node_id, cmd,
+    netdata_log_info("Queuing status update for node=%s, live=%d, hops=%u",(char*)node_state_update.node_id, cmd,
          host->system_info->hops);
     freez((void*)node_state_update.node_id);
     query->data.bin_payload.msg_name = "UpdateNodeInstanceConnection";
@@ -990,7 +990,7 @@ void aclk_send_node_instances()
             node_state_update.claim_id = localhost->aclk_state.claimed_id;
             query->data.bin_payload.payload = generate_node_instance_connection(&query->data.bin_payload.size, &node_state_update);
             rrdhost_aclk_state_unlock(localhost);
-            info("Queuing status update for node=%s, live=%d, hops=%d",(char*)node_state_update.node_id,
+            netdata_log_info("Queuing status update for node=%s, live=%d, hops=%d",(char*)node_state_update.node_id,
                  list->live,
                  list->hops);
 
@@ -1014,7 +1014,7 @@ void aclk_send_node_instances()
             node_instance_creation.claim_id = localhost->aclk_state.claimed_id,
             create_query->data.bin_payload.payload = generate_node_instance_creation(&create_query->data.bin_payload.size, &node_instance_creation);
             rrdhost_aclk_state_unlock(localhost);
-            info("Queuing registration for host=%s, hops=%d",(char*)node_instance_creation.machine_guid,
+            netdata_log_info("Queuing registration for host=%s, hops=%d",(char*)node_instance_creation.machine_guid,
                  list->hops);
             freez((void *)node_instance_creation.machine_guid);
             aclk_queue_query(create_query);

+ 3 - 3
aclk/aclk_otp.c

@@ -335,7 +335,7 @@ int aclk_get_otp_challenge(url_t *target, const char *agent_id, unsigned char **
     }
     buffer_free(url);
 
-    info ("ACLK_OTP Got Challenge from Cloud");
+    netdata_log_info("ACLK_OTP Got Challenge from Cloud");
 
     json_object *json = json_tokener_parse(resp.payload);
     if (!json) {
@@ -414,7 +414,7 @@ int aclk_send_otp_response(const char *agent_id, const unsigned char *response,
             aclk_parse_otp_error(resp.payload);
         goto cleanup_response;
     }
-    info ("ACLK_OTP Got Password from Cloud");
+    netdata_log_info("ACLK_OTP Got Password from Cloud");
 
     if (parse_passwd_response(resp.payload, mqtt_auth)){
         error("Error parsing response of password endpoint");
@@ -871,7 +871,7 @@ int aclk_get_env(aclk_env_t *env, const char* aclk_hostname, int aclk_port) {
         return 5;
     }
 
-    info("Getting Cloud /env successful");
+    netdata_log_info("Getting Cloud /env successful");
 
     https_req_response_free(&resp);
     buffer_free(buf);

+ 1 - 1
aclk/aclk_query.c

@@ -357,7 +357,7 @@ void *aclk_query_main_thread(void *ptr)
 #define TASK_LEN_MAX 22
 void aclk_query_threads_start(struct aclk_query_threads *query_threads, mqtt_wss_client client)
 {
-    info("Starting %d query threads.", query_threads->count);
+    netdata_log_info("Starting %d query threads.", query_threads->count);
 
     char thread_name[TASK_LEN_MAX];
     query_threads->thread_list = callocz(query_threads->count, sizeof(struct aclk_query_thread));

+ 2 - 2
aclk/aclk_rx_msgs.c

@@ -399,10 +399,10 @@ int handle_disconnect_req(const char *msg, size_t msg_len)
         error("Cloud Banned This Agent!");
         aclk_disable_runtime = 1;
     }
-    info("Cloud requested disconnect (EC=%u, \"%s\")", (unsigned int)cmd->error_code, cmd->error_description);
+    netdata_log_info("Cloud requested disconnect (EC=%u, \"%s\")", (unsigned int)cmd->error_code, cmd->error_description);
     if (cmd->reconnect_after_s > 0) {
         aclk_block_until = now_monotonic_sec() + cmd->reconnect_after_s;
-        info(
+        netdata_log_info(
             "Cloud asks not to reconnect for %u seconds. We shall honor that request",
             (unsigned int)cmd->reconnect_after_s);
     }

+ 2 - 2
aclk/https_client.c

@@ -524,7 +524,7 @@ int https_request(https_req_t *request, https_req_response_t *response) {
             error("Proxy didn't return 200 OK (got %d)", ctx->parse_ctx.http_code);
             goto exit_sock;
         }
-        info("Proxy accepted CONNECT upgrade");
+        netdata_log_info("Proxy accepted CONNECT upgrade");
     }
     ctx->request = request;
 
@@ -584,7 +584,7 @@ int https_request(https_req_t *request, https_req_response_t *response) {
         // only exact data without affixed 0x00
         ((char*)response->payload)[response->payload_size] = 0; // mallocz(response->payload_size + 1);
     }
-    info("HTTPS \"%s\" request to \"%s\" finished with HTTP code: %d", http_req_type_to_str(ctx->request->request_type), ctx->request->host, response->http_code);
+    netdata_log_info("HTTPS \"%s\" request to \"%s\" finished with HTTP code: %d", http_req_type_to_str(ctx->request->request_type), ctx->request->host, response->http_code);
 
     rc = 0;
 

+ 7 - 7
claim/claim.c

@@ -83,16 +83,16 @@ void claim_agent(char *claiming_arguments)
               cloud_base_url,
               claiming_arguments);
 
-    info("Executing agent claiming command 'netdata-claim.sh'");
+    netdata_log_info("Executing agent claiming command 'netdata-claim.sh'");
     fp_child_output = netdata_popen(command_buffer, &command_pid, &fp_child_input);
     if(!fp_child_output) {
         error("Cannot popen(\"%s\").", command_buffer);
         return;
     }
-    info("Waiting for claiming command to finish.");
+    netdata_log_info("Waiting for claiming command to finish.");
     while (fgets(command_buffer, CLAIMING_COMMAND_LENGTH, fp_child_output) != NULL) {;}
     exit_code = netdata_pclose(fp_child_input, fp_child_output, command_pid);
-    info("Agent claiming command returned with code %d", exit_code);
+    netdata_log_info("Agent claiming command returned with code %d", exit_code);
     if (0 == exit_code) {
         load_claiming_state();
         return;
@@ -148,7 +148,7 @@ void load_claiming_state(void)
     }
     if (aclk_connected)
     {
-        info("Agent was already connected to Cloud - forcing reconnection under new credentials");
+        netdata_log_info("Agent was already connected to Cloud - forcing reconnection under new credentials");
         aclk_kill_link = 1;
     }
     aclk_disable_runtime = 0;
@@ -174,13 +174,13 @@ void load_claiming_state(void)
     rrdhost_aclk_state_unlock(localhost);
 
     if (!claimed_id) {
-        info("Unable to load '%s', setting state to AGENT_UNCLAIMED", filename);
+        netdata_log_info("Unable to load '%s', setting state to AGENT_UNCLAIMED", filename);
         return;
     }
 
     freez(claimed_id);
 
-    info("File '%s' was found. Setting state to AGENT_CLAIMED.", filename);
+    netdata_log_info("File '%s' was found. Setting state to AGENT_CLAIMED.", filename);
     netdata_cloud_enabled = appconfig_get_boolean(&cloud_config, CONFIG_SECTION_GLOBAL, "enabled", 1);
 #endif
 }
@@ -202,7 +202,7 @@ void load_cloud_conf(int silent)
 
     ret = appconfig_load(&cloud_config, filename, 1, NULL);
     if(!ret && !silent) {
-        info("CONFIG: cannot load cloud config '%s'. Running with internal defaults.", filename);
+        netdata_log_info("CONFIG: cannot load cloud config '%s'. Running with internal defaults.", filename);
     }
     freez(filename);
 }

+ 15 - 15
collectors/apps.plugin/apps_plugin.c

@@ -1471,7 +1471,7 @@ static inline int read_proc_pid_stat(struct pid_stat *p, void *ptr) {
 
     if(enable_guest_charts) {
         enable_guest_charts = 0;
-        info("Guest charts aren't supported by FreeBSD");
+        netdata_log_info("Guest charts aren't supported by FreeBSD");
     }
 #else
     pid_incremental_rate(stat, p->minflt,  str2kernel_uint_t(procfile_lineword(ff, 0,  9)));
@@ -4194,28 +4194,28 @@ static void parse_args(int argc, char **argv)
     if(freq > 0) update_every = freq;
 
     if(read_apps_groups_conf(user_config_dir, "groups")) {
-        info("Cannot read process groups configuration file '%s/apps_groups.conf'. Will try '%s/apps_groups.conf'", user_config_dir, stock_config_dir);
+        netdata_log_info("Cannot read process groups configuration file '%s/apps_groups.conf'. Will try '%s/apps_groups.conf'", user_config_dir, stock_config_dir);
 
         if(read_apps_groups_conf(stock_config_dir, "groups")) {
             error("Cannot read process groups '%s/apps_groups.conf'. There are no internal defaults. Failing.", stock_config_dir);
             exit(1);
         }
         else
-            info("Loaded config file '%s/apps_groups.conf'", stock_config_dir);
+            netdata_log_info("Loaded config file '%s/apps_groups.conf'", stock_config_dir);
     }
     else
-        info("Loaded config file '%s/apps_groups.conf'", user_config_dir);
+        netdata_log_info("Loaded config file '%s/apps_groups.conf'", user_config_dir);
 }
 
 static int am_i_running_as_root() {
     uid_t uid = getuid(), euid = geteuid();
 
     if(uid == 0 || euid == 0) {
-        if(debug_enabled) info("I am running with escalated privileges, uid = %u, euid = %u.", uid, euid);
+        if(debug_enabled) netdata_log_info("I am running with escalated privileges, uid = %u, euid = %u.", uid, euid);
         return 1;
     }
 
-    if(debug_enabled) info("I am not running with escalated privileges, uid = %u, euid = %u.", uid, euid);
+    if(debug_enabled) netdata_log_info("I am not running with escalated privileges, uid = %u, euid = %u.", uid, euid);
     return 0;
 }
 
@@ -4227,7 +4227,7 @@ static int check_capabilities() {
         return 0;
     }
     else if(debug_enabled)
-        info("Received my capabilities from the system.");
+        netdata_log_info("Received my capabilities from the system.");
 
     int ret = 1;
 
@@ -4242,7 +4242,7 @@ static int check_capabilities() {
             ret = 0;
         }
         else if(debug_enabled)
-            info("apps.plugin runs with CAP_DAC_READ_SEARCH.");
+            netdata_log_info("apps.plugin runs with CAP_DAC_READ_SEARCH.");
     }
 
     cfv = CAP_CLEAR;
@@ -4256,7 +4256,7 @@ static int check_capabilities() {
             ret = 0;
         }
         else if(debug_enabled)
-            info("apps.plugin runs with CAP_SYS_PTRACE.");
+            netdata_log_info("apps.plugin runs with CAP_SYS_PTRACE.");
     }
 
     cap_free(caps);
@@ -5311,23 +5311,23 @@ int main(int argc, char **argv) {
 
     user_config_dir = getenv("NETDATA_USER_CONFIG_DIR");
     if(user_config_dir == NULL) {
-        // info("NETDATA_CONFIG_DIR is not passed from netdata");
+        // netdata_log_info("NETDATA_CONFIG_DIR is not passed from netdata");
         user_config_dir = CONFIG_DIR;
     }
-    // else info("Found NETDATA_USER_CONFIG_DIR='%s'", user_config_dir);
+    // else netdata_log_info("Found NETDATA_USER_CONFIG_DIR='%s'", user_config_dir);
 
     stock_config_dir = getenv("NETDATA_STOCK_CONFIG_DIR");
     if(stock_config_dir == NULL) {
-        // info("NETDATA_CONFIG_DIR is not passed from netdata");
+        // netdata_log_info("NETDATA_CONFIG_DIR is not passed from netdata");
         stock_config_dir = LIBCONFIG_DIR;
     }
-    // else info("Found NETDATA_USER_CONFIG_DIR='%s'", user_config_dir);
+    // else netdata_log_info("Found NETDATA_USER_CONFIG_DIR='%s'", user_config_dir);
 
 #ifdef NETDATA_INTERNAL_CHECKS
     if(debug_flags != 0) {
         struct rlimit rl = { RLIM_INFINITY, RLIM_INFINITY };
         if(setrlimit(RLIMIT_CORE, &rl) != 0)
-            info("Cannot request unlimited core dumps for debugging... Proceeding anyway...");
+            netdata_log_info("Cannot request unlimited core dumps for debugging... Proceeding anyway...");
 #ifdef HAVE_SYS_PRCTL_H
         prctl(PR_SET_DUMPABLE, 1, 0, 0, 0);
 #endif
@@ -5367,7 +5367,7 @@ int main(int argc, char **argv) {
 #endif
     }
 
-    info("started on pid %d", getpid());
+    netdata_log_info("started on pid %d", getpid());
 
     snprintfz(all_user_ids.filename, FILENAME_MAX, "%s/etc/passwd", netdata_configured_host_prefix);
     debug_log("passwd file: '%s'", all_user_ids.filename);

+ 1 - 1
collectors/cups.plugin/cups_plugin.c

@@ -438,5 +438,5 @@ int main(int argc, char **argv) {
     }
 
     httpClose(http);
-    info("CUPS process exiting");
+    netdata_log_info("CUPS process exiting");
 }

+ 2 - 2
collectors/debugfs.plugin/debugfs_plugin.c

@@ -176,7 +176,7 @@ int main(int argc, char **argv)
 
     stock_config_dir = getenv("NETDATA_STOCK_CONFIG_DIR");
     if (stock_config_dir == NULL) {
-        // info("NETDATA_CONFIG_DIR is not passed from netdata");
+        // netdata_log_info("NETDATA_CONFIG_DIR is not passed from netdata");
         stock_config_dir = LIBCONFIG_DIR;
     }
 
@@ -235,7 +235,7 @@ int main(int argc, char **argv)
                 enabled++;
         }
         if (!enabled) {
-            info("all modules are disabled, exiting...");
+            netdata_log_info("all modules are disabled, exiting...");
             return 1;
         }
     }

+ 1 - 1
collectors/debugfs.plugin/debugfs_zswap.c

@@ -383,7 +383,7 @@ int do_debugfs_zswap(int update_every, const char *name)
     static int check_if_enabled = 1;
 
     if (likely(check_if_enabled && debugfs_is_zswap_enabled())) {
-        info("Zswap is disabled");
+        netdata_log_info("Zswap is disabled");
         return 1;
     }
 

Some files were not shown because too many files changed in this diff