diff options
author | thiagoftsm <thiagoftsm@gmail.com> | 2023-07-11 14:45:16 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-07-11 14:45:16 +0000 |
commit | f672f4a95584da2a9978f5dca11eba34dc8a8c3b (patch) | |
tree | d8b6a1233d2d107725f179fc07d0b6317e7be859 /libnetdata | |
parent | f00b3980162bbe731475d53afd4e7df9559a4d27 (diff) |
Rename log Macros (debug) (#15322)
Diffstat (limited to 'libnetdata')
-rw-r--r-- | libnetdata/buffer/buffer.c | 10 | ||||
-rw-r--r-- | libnetdata/config/appconfig.c | 28 | ||||
-rw-r--r-- | libnetdata/dictionary/dictionary.c | 20 | ||||
-rw-r--r-- | libnetdata/ebpf/ebpf.c | 1 | ||||
-rw-r--r-- | libnetdata/health/health.c | 12 | ||||
-rw-r--r-- | libnetdata/libnetdata.c | 18 | ||||
-rw-r--r-- | libnetdata/locks/locks.c | 20 | ||||
-rw-r--r-- | libnetdata/log/log.h | 4 | ||||
-rw-r--r-- | libnetdata/os.c | 2 | ||||
-rw-r--r-- | libnetdata/popen/popen.c | 2 | ||||
-rw-r--r-- | libnetdata/procfile/procfile.c | 46 | ||||
-rw-r--r-- | libnetdata/simple_pattern/simple_pattern.c | 4 | ||||
-rw-r--r-- | libnetdata/socket/security.c | 4 | ||||
-rw-r--r-- | libnetdata/socket/socket.c | 80 | ||||
-rw-r--r-- | libnetdata/threads/threads.c | 2 |
15 files changed, 126 insertions, 127 deletions
diff --git a/libnetdata/buffer/buffer.c b/libnetdata/buffer/buffer.c index c54382abd3..b437628633 100644 --- a/libnetdata/buffer/buffer.c +++ b/libnetdata/buffer/buffer.c @@ -107,7 +107,7 @@ void buffer_vsprintf(BUFFER *wb, const char *fmt, va_list args) do { need += space_remaining * 2; - debug(D_WEB_BUFFER, "web_buffer_sprintf(): increasing web_buffer at position %zu, size = %zu, by %zu bytes (wrote = %zu)\n", wb->len, wb->size, need, wrote); + netdata_log_debug(D_WEB_BUFFER, "web_buffer_sprintf(): increasing web_buffer at position %zu, size = %zu, by %zu bytes (wrote = %zu)\n", wb->len, wb->size, need, wrote); buffer_need_bytes(wb, need); space_remaining = wb->size - wb->len - 1; @@ -131,7 +131,7 @@ void buffer_sprintf(BUFFER *wb, const char *fmt, ...) do { need += space_remaining * 2; - debug(D_WEB_BUFFER, "web_buffer_sprintf(): increasing web_buffer at position %zu, size = %zu, by %zu bytes (wrote = %zu)\n", wb->len, wb->size, need, wrote); + netdata_log_debug(D_WEB_BUFFER, "web_buffer_sprintf(): increasing web_buffer at position %zu, size = %zu, by %zu bytes (wrote = %zu)\n", wb->len, wb->size, need, wrote); buffer_need_bytes(wb, need); space_remaining = wb->size - wb->len - 1; @@ -246,7 +246,7 @@ BUFFER *buffer_create(size_t size, size_t *statistics) { BUFFER *b; - debug(D_WEB_BUFFER, "Creating new web buffer of size %zu.", size); + netdata_log_debug(D_WEB_BUFFER, "Creating new web buffer of size %zu.", size); b = callocz(1, sizeof(BUFFER)); b->buffer = mallocz(size + sizeof(BUFFER_OVERFLOW_EOF) + 2); @@ -268,7 +268,7 @@ void buffer_free(BUFFER *b) { buffer_overflow_check(b); - debug(D_WEB_BUFFER, "Freeing web buffer of size %zu.", b->size); + netdata_log_debug(D_WEB_BUFFER, "Freeing web buffer of size %zu.", b->size); if(b->statistics) __atomic_sub_fetch(b->statistics, b->size + sizeof(BUFFER) + sizeof(BUFFER_OVERFLOW_EOF) + 2, __ATOMIC_RELAXED); @@ -290,7 +290,7 @@ void buffer_increase(BUFFER *b, size_t free_size_required) { size_t optimal = (b->size > 5*1024*1024) ? b->size / 2 : b->size; if(optimal > wanted) wanted = optimal; - debug(D_WEB_BUFFER, "Increasing data buffer from size %zu to %zu.", b->size, b->size + wanted); + netdata_log_debug(D_WEB_BUFFER, "Increasing data buffer from size %zu to %zu.", b->size, b->size + wanted); b->buffer = reallocz(b->buffer, b->size + wanted + sizeof(BUFFER_OVERFLOW_EOF) + 2); b->size += wanted; diff --git a/libnetdata/config/appconfig.c b/libnetdata/config/appconfig.c index 59a1da7897..fe4c1222d4 100644 --- a/libnetdata/config/appconfig.c +++ b/libnetdata/config/appconfig.c @@ -164,7 +164,7 @@ static inline struct section *appconfig_section_find(struct config *root, const } static inline struct section *appconfig_section_create(struct config *root, const char *section) { - debug(D_CONFIG, "Creating section '%s'.", section); + netdata_log_debug(D_CONFIG, "Creating section '%s'.", section); struct section *co = callocz(1, sizeof(struct section)); co->name = strdupz(section); @@ -194,7 +194,7 @@ void appconfig_section_destroy_non_loaded(struct config *root, const char *secti struct section *co; struct config_option *cv, *cv_next; - debug(D_CONFIG, "Destroying section '%s'.", section); + netdata_log_debug(D_CONFIG, "Destroying section '%s'.", section); co = appconfig_section_find(root, section); if(!co) { @@ -259,7 +259,7 @@ void appconfig_section_destroy_non_loaded(struct config *root, const char *secti void appconfig_section_option_destroy_non_loaded(struct config *root, const char *section, const char *name) { - debug(D_CONFIG, "Destroying section option '%s -> %s'.", section, name); + netdata_log_debug(D_CONFIG, "Destroying section option '%s -> %s'.", section, name); struct section *co; co = appconfig_section_find(root, section); @@ -310,7 +310,7 @@ void appconfig_section_option_destroy_non_loaded(struct config *root, const char // config name-value methods static inline struct config_option *appconfig_value_create(struct section *co, const char *name, const char *value) { - debug(D_CONFIG, "Creating config entry for name '%s', value '%s', in section '%s'.", name, value, co->name); + netdata_log_debug(D_CONFIG, "Creating config entry for name '%s', value '%s', in section '%s'.", name, value, co->name); struct config_option *cv = callocz(1, sizeof(struct config_option)); cv->name = strdupz(name); @@ -341,7 +341,7 @@ static inline struct config_option *appconfig_value_create(struct section *co, c int appconfig_exists(struct config *root, const char *section, const char *name) { struct config_option *cv; - debug(D_CONFIG, "request to get config in section '%s', name '%s'", section, name); + netdata_log_debug(D_CONFIG, "request to get config in section '%s', name '%s'", section, name); struct section *co = appconfig_section_find(root, section); if(!co) return 0; @@ -356,7 +356,7 @@ int appconfig_move(struct config *root, const char *section_old, const char *nam struct config_option *cv_old, *cv_new; int ret = -1; - debug(D_CONFIG, "request to rename config in section '%s', old name '%s', to section '%s', new name '%s'", section_old, name_old, section_new, name_new); + netdata_log_debug(D_CONFIG, "request to rename config in section '%s', old name '%s', to section '%s', new name '%s'", section_old, name_old, section_new, name_new); struct section *co_old = appconfig_section_find(root, section_old); if(!co_old) return ret; @@ -439,9 +439,9 @@ char *appconfig_get_by_section(struct section *co, const char *name, const char char *appconfig_get(struct config *root, const char *section, const char *name, const char *default_value) { if (default_value == NULL) - debug(D_CONFIG, "request to get config in section '%s', name '%s' or fail", section, name); + netdata_log_debug(D_CONFIG, "request to get config in section '%s', name '%s' or fail", section, name); else - debug(D_CONFIG, "request to get config in section '%s', name '%s', default_value '%s'", section, name, default_value); + netdata_log_debug(D_CONFIG, "request to get config in section '%s', name '%s', default_value '%s'", section, name, default_value); struct section *co = appconfig_section_find(root, section); if (!co && !default_value) @@ -532,7 +532,7 @@ const char *appconfig_set_default(struct config *root, const char *section, cons { struct config_option *cv; - debug(D_CONFIG, "request to set default config in section '%s', name '%s', value '%s'", section, name, value); + netdata_log_debug(D_CONFIG, "request to set default config in section '%s', name '%s', value '%s'", section, name, value); struct section *co = appconfig_section_find(root, section); if(!co) return appconfig_set(root, section, name, value); @@ -559,7 +559,7 @@ const char *appconfig_set(struct config *root, const char *section, const char * { struct config_option *cv; - debug(D_CONFIG, "request to set config in section '%s', name '%s', value '%s'", section, name, value); + netdata_log_debug(D_CONFIG, "request to set config in section '%s', name '%s', value '%s'", section, name, value); struct section *co = appconfig_section_find(root, section); if(!co) co = appconfig_section_create(root, section); @@ -649,7 +649,7 @@ int appconfig_load(struct config *root, char *filename, int overwrite_used, cons if(!filename) filename = CONFIG_DIR "/" CONFIG_FILENAME; - debug(D_CONFIG, "CONFIG: opening config file '%s'", filename); + netdata_log_debug(D_CONFIG, "CONFIG: opening config file '%s'", filename); FILE *fp = fopen(filename, "r"); if(!fp) { @@ -669,7 +669,7 @@ int appconfig_load(struct config *root, char *filename, int overwrite_used, cons s = trim(buffer); if(!s || *s == '#') { - debug(D_CONFIG, "CONFIG: ignoring line %d of file '%s', it is empty.", line, filename); + netdata_log_debug(D_CONFIG, "CONFIG: ignoring line %d of file '%s', it is empty.", line, filename); continue; } @@ -778,12 +778,12 @@ int appconfig_load(struct config *root, char *filename, int overwrite_used, cons } } else { if (((cv->flags & CONFIG_VALUE_USED) && overwrite_used) || !(cv->flags & CONFIG_VALUE_USED)) { - debug( + netdata_log_debug( D_CONFIG, "CONFIG: line %d of file '%s', overwriting '%s/%s'.", line, filename, co->name, cv->name); freez(cv->value); cv->value = strdupz(value); } else - debug( + netdata_log_debug( D_CONFIG, "CONFIG: ignoring line %d of file '%s', '%s/%s' is already present and used.", line, diff --git a/libnetdata/dictionary/dictionary.c b/libnetdata/dictionary/dictionary.c index bb76e6f6f1..05da553444 100644 --- a/libnetdata/dictionary/dictionary.c +++ b/libnetdata/dictionary/dictionary.c @@ -1065,7 +1065,7 @@ static size_t hashtable_destroy_unsafe(DICTIONARY *dict) { JU_ERRNO(&J_Error), JU_ERRID(&J_Error)); } - debug(D_DICTIONARY, "Dictionary: hash table freed %lu bytes", ret); + netdata_log_debug(D_DICTIONARY, "Dictionary: hash table freed %lu bytes", ret); dict->index.JudyHSArray = NULL; return (size_t)ret; @@ -1376,7 +1376,7 @@ static void dict_item_reset_value_with_hooks(DICTIONARY *dict, DICTIONARY_ITEM * if(unlikely(is_view_dictionary(dict))) fatal("DICTIONARY: %s() should never be called on views.", __FUNCTION__ ); - debug(D_DICTIONARY, "Dictionary entry with name '%s' found. Changing its value.", item_get_name(item)); + netdata_log_debug(D_DICTIONARY, "Dictionary entry with name '%s' found. Changing its value.", item_get_name(item)); DICTIONARY_VALUE_RESETS_PLUS1(dict); @@ -1388,12 +1388,12 @@ static void dict_item_reset_value_with_hooks(DICTIONARY *dict, DICTIONARY_ITEM * dictionary_execute_delete_callback(dict, item); if(likely(dict->options & DICT_OPTION_VALUE_LINK_DONT_CLONE)) { - debug(D_DICTIONARY, "Dictionary: linking value to '%s'", item_get_name(item)); + netdata_log_debug(D_DICTIONARY, "Dictionary: linking value to '%s'", item_get_name(item)); item->shared->value = value; item->shared->value_len = value_len; } else { - debug(D_DICTIONARY, "Dictionary: cloning value to '%s'", item_get_name(item)); + netdata_log_debug(D_DICTIONARY, "Dictionary: cloning value to '%s'", item_get_name(item)); void *old_value = item->shared->value; void *new_value = NULL; @@ -1405,7 +1405,7 @@ static void dict_item_reset_value_with_hooks(DICTIONARY *dict, DICTIONARY_ITEM * item->shared->value = new_value; item->shared->value_len = value_len; - debug(D_DICTIONARY, "Dictionary: freeing old value of '%s'", item_get_name(item)); + netdata_log_debug(D_DICTIONARY, "Dictionary: freeing old value of '%s'", item_get_name(item)); dict_item_value_freez(dict, old_value); } @@ -1413,7 +1413,7 @@ static void dict_item_reset_value_with_hooks(DICTIONARY *dict, DICTIONARY_ITEM * } static size_t dict_item_free_with_hooks(DICTIONARY *dict, DICTIONARY_ITEM *item) { - debug(D_DICTIONARY, "Destroying name value entry for name '%s'.", item_get_name(item)); + netdata_log_debug(D_DICTIONARY, "Destroying name value entry for name '%s'.", item_get_name(item)); if(!item_flag_check(item, ITEM_FLAG_DELETED)) DICTIONARY_ENTRIES_MINUS1(dict); @@ -1428,7 +1428,7 @@ static size_t dict_item_free_with_hooks(DICTIONARY *dict, DICTIONARY_ITEM *item) dictionary_execute_delete_callback(dict, item); if(unlikely(!(dict->options & DICT_OPTION_VALUE_LINK_DONT_CLONE))) { - debug(D_DICTIONARY, "Dictionary freeing value of '%s'", item_get_name(item)); + netdata_log_debug(D_DICTIONARY, "Dictionary freeing value of '%s'", item_get_name(item)); dict_item_value_freez(dict, item->shared->value); item->shared->value = NULL; } @@ -1554,7 +1554,7 @@ static bool dict_item_del(DICTIONARY *dict, const char *name, ssize_t name_len) if(name_len == -1) name_len = (ssize_t)strlen(name) + 1; // we need the terminating null too - debug(D_DICTIONARY, "DEL dictionary entry with name '%s'.", name); + netdata_log_debug(D_DICTIONARY, "DEL dictionary entry with name '%s'.", name); // Unfortunately, the JudyHSDel() does not return the value of the // item that was deleted, so we have to find it before we delete it, @@ -1605,7 +1605,7 @@ static DICTIONARY_ITEM *dict_item_add_or_reset_value_and_acquire(DICTIONARY *dic if(name_len == -1) name_len = (ssize_t)strlen(name) + 1; // we need the terminating null too - debug(D_DICTIONARY, "SET dictionary entry with name '%s'.", name); + netdata_log_debug(D_DICTIONARY, "SET dictionary entry with name '%s'.", name); // DISCUSSION: // Is it better to gain a read-lock and do a hashtable_get_unsafe() @@ -1724,7 +1724,7 @@ static DICTIONARY_ITEM *dict_item_find_and_acquire(DICTIONARY *dict, const char if(name_len == -1) name_len = (ssize_t)strlen(name) + 1; // we need the terminating null too - debug(D_DICTIONARY, "GET dictionary entry with name '%s'.", name); + netdata_log_debug(D_DICTIONARY, "GET dictionary entry with name '%s'.", name); dictionary_index_lock_rdlock(dict); diff --git a/libnetdata/ebpf/ebpf.c b/libnetdata/ebpf/ebpf.c index c41a0021ee..ed7aa9a4c9 100644 --- a/libnetdata/ebpf/ebpf.c +++ b/libnetdata/ebpf/ebpf.c @@ -44,7 +44,6 @@ static int clean_kprobe_event(FILE *out, char *filename, char *father_pid, netda int clean_kprobe_events(FILE *out, int pid, netdata_ebpf_events_t *ptr) { - debug(D_EXIT, "Cleaning parent process events."); char filename[FILENAME_MAX + 1]; snprintf(filename, FILENAME_MAX, "%s%s", NETDATA_DEBUGFS, "kprobe_events"); diff --git a/libnetdata/health/health.c b/libnetdata/health/health.c index 505df4e5ab..53ebecb42a 100644 --- a/libnetdata/health/health.c +++ b/libnetdata/health/health.c @@ -11,7 +11,7 @@ SILENCERS *silencers; */ SILENCER *create_silencer(void) { SILENCER *t = callocz(1, sizeof(SILENCER)); - debug(D_HEALTH, "HEALTH command API: Created empty silencer"); + netdata_log_debug(D_HEALTH, "HEALTH command API: Created empty silencer"); return t; } @@ -27,7 +27,7 @@ void health_silencers_add(SILENCER *silencer) { // Add the created instance to the linked list in silencers silencer->next = silencers->silencers; silencers->silencers = silencer; - debug(D_HEALTH, "HEALTH command API: Added silencer %s:%s:%s:%s:%s", silencer->alarms, + netdata_log_debug(D_HEALTH, "HEALTH command API: Added silencer %s:%s:%s:%s:%s", silencer->alarms, silencer->charts, silencer->contexts, silencer->hosts, silencer->families ); } @@ -116,7 +116,7 @@ int health_silencers_json_read_callback(JSON_ENTRY *e) e->callback_function = health_silencers_json_read_callback; if(strcmp(e->name,"")) { // init silencer - debug(D_HEALTH, "JSON: Got object with a name, initializing new silencer for %s",e->name); + netdata_log_debug(D_HEALTH, "JSON: Got object with a name, initializing new silencer for %s",e->name); #endif e->callback_data = create_silencer(); if(e->callback_data) { @@ -133,18 +133,18 @@ int health_silencers_json_read_callback(JSON_ENTRY *e) case JSON_STRING: if(!strcmp(e->name,"type")) { - debug(D_HEALTH, "JSON: Processing type=%s",e->data.string); + netdata_log_debug(D_HEALTH, "JSON: Processing type=%s",e->data.string); if (!strcmp(e->data.string,"SILENCE")) silencers->stype = STYPE_SILENCE_NOTIFICATIONS; else if (!strcmp(e->data.string,"DISABLE")) silencers->stype = STYPE_DISABLE_ALARMS; } else { - debug(D_HEALTH, "JSON: Adding %s=%s", e->name, e->data.string); + netdata_log_debug(D_HEALTH, "JSON: Adding %s=%s", e->name, e->data.string); if (e->callback_data) (void)health_silencers_addparam(e->callback_data, e->name, e->data.string); } break; case JSON_BOOLEAN: - debug(D_HEALTH, "JSON: Processing all_alarms"); + netdata_log_debug(D_HEALTH, "JSON: Processing all_alarms"); silencers->all_alarms=e->data.boolean?1:0; break; diff --git a/libnetdata/libnetdata.c b/libnetdata/libnetdata.c index 0174d4d3d7..272ba8f17a 100644 --- a/libnetdata/libnetdata.c +++ b/libnetdata/libnetdata.c @@ -1529,7 +1529,7 @@ void recursive_config_double_dir_load(const char *user_path, const char *stock_p char *udir = strdupz_path_subpath(user_path, subpath); char *sdir = strdupz_path_subpath(stock_path, subpath); - debug(D_HEALTH, "CONFIG traversing user-config directory '%s', stock config directory '%s'", udir, sdir); + netdata_log_debug(D_HEALTH, "CONFIG traversing user-config directory '%s', stock config directory '%s'", udir, sdir); DIR *dir = opendir(udir); if (!dir) { @@ -1543,7 +1543,7 @@ void recursive_config_double_dir_load(const char *user_path, const char *stock_p (de->d_name[0] == '.' && de->d_name[1] == '\0') || (de->d_name[0] == '.' && de->d_name[1] == '.' && de->d_name[2] == '\0') ) { - debug(D_HEALTH, "CONFIG ignoring user-config directory '%s/%s'", udir, de->d_name); + netdata_log_debug(D_HEALTH, "CONFIG ignoring user-config directory '%s/%s'", udir, de->d_name); continue; } @@ -1558,20 +1558,20 @@ void recursive_config_double_dir_load(const char *user_path, const char *stock_p if(path_is_file(udir, de->d_name) && len > 5 && !strcmp(&de->d_name[len - 5], ".conf")) { char *filename = strdupz_path_subpath(udir, de->d_name); - debug(D_HEALTH, "CONFIG calling callback for user file '%s'", filename); + netdata_log_debug(D_HEALTH, "CONFIG calling callback for user file '%s'", filename); callback(filename, data); freez(filename); continue; } } - debug(D_HEALTH, "CONFIG ignoring user-config file '%s/%s' of type %d", udir, de->d_name, (int)de->d_type); + netdata_log_debug(D_HEALTH, "CONFIG ignoring user-config file '%s/%s' of type %d", udir, de->d_name, (int)de->d_type); } closedir(dir); } - debug(D_HEALTH, "CONFIG traversing stock config directory '%s', user config directory '%s'", sdir, udir); + netdata_log_debug(D_HEALTH, "CONFIG traversing stock config directory '%s', user config directory '%s'", sdir, udir); dir = opendir(sdir); if (!dir) { @@ -1586,7 +1586,7 @@ void recursive_config_double_dir_load(const char *user_path, const char *stock_p (de->d_name[0] == '.' && de->d_name[1] == '\0') || (de->d_name[0] == '.' && de->d_name[1] == '.' && de->d_name[2] == '\0') ) { - debug(D_HEALTH, "CONFIG ignoring stock config directory '%s/%s'", sdir, de->d_name); + netdata_log_debug(D_HEALTH, "CONFIG ignoring stock config directory '%s/%s'", sdir, de->d_name); continue; } @@ -1606,7 +1606,7 @@ void recursive_config_double_dir_load(const char *user_path, const char *stock_p if(path_is_file(sdir, de->d_name) && !path_is_file(udir, de->d_name) && len > 5 && !strcmp(&de->d_name[len - 5], ".conf")) { char *filename = strdupz_path_subpath(sdir, de->d_name); - debug(D_HEALTH, "CONFIG calling callback for stock file '%s'", filename); + netdata_log_debug(D_HEALTH, "CONFIG calling callback for stock file '%s'", filename); callback(filename, data); freez(filename); continue; @@ -1614,13 +1614,13 @@ void recursive_config_double_dir_load(const char *user_path, const char *stock_p } - debug(D_HEALTH, "CONFIG ignoring stock-config file '%s/%s' of type %d", udir, de->d_name, (int)de->d_type); + netdata_log_debug(D_HEALTH, "CONFIG ignoring stock-config file '%s/%s' of type %d", udir, de->d_name, (int)de->d_type); } } closedir(dir); } - debug(D_HEALTH, "CONFIG done traversing user-config directory '%s', stock config directory '%s'", udir, sdir); + netdata_log_debug(D_HEALTH, "CONFIG done traversing user-config directory '%s', stock config directory '%s'", udir, sdir); freez(udir); freez(sdir); diff --git a/libnetdata/locks/locks.c b/libnetdata/locks/locks.c index 7c806688d9..625dd052ce 100644 --- a/libnetdata/locks/locks.c +++ b/libnetdata/locks/locks.c @@ -135,29 +135,29 @@ int __netdata_mutex_unlock(netdata_mutex_t *mutex) { int netdata_mutex_init_debug(const char *file __maybe_unused, const char *function __maybe_unused, const unsigned long line __maybe_unused, netdata_mutex_t *mutex) { - debug(D_LOCKS, "MUTEX_LOCK: netdata_mutex_init(%p) from %lu@%s, %s()", mutex, line, file, function); + netdata_log_debug(D_LOCKS, "MUTEX_LOCK: netdata_mutex_init(%p) from %lu@%s, %s()", mutex, line, file, function); int ret = __netdata_mutex_init(mutex); - debug(D_LOCKS, "MUTEX_LOCK: netdata_mutex_init(%p) = %d, from %lu@%s, %s()", mutex, ret, line, file, function); + netdata_log_debug(D_LOCKS, "MUTEX_LOCK: netdata_mutex_init(%p) = %d, from %lu@%s, %s()", mutex, ret, line, file, function); return ret; } int netdata_mutex_destroy_debug(const char *file __maybe_unused, const char *function __maybe_unused, const unsigned long line __maybe_unused, netdata_mutex_t *mutex) { - debug(D_LOCKS, "MUTEX_LOCK: netdata_mutex_destroy(%p) from %lu@%s, %s()", mutex, line, file, function); + netdata_log_debug(D_LOCKS, "MUTEX_LOCK: netdata_mutex_destroy(%p) from %lu@%s, %s()", mutex, line, file, function); int ret = __netdata_mutex_destroy(mutex); - debug(D_LOCKS, "MUTEX_LOCK: netdata_mutex_destroy(%p) = %d, from %lu@%s, %s()", mutex, ret, line, file, function); + netdata_log_debug(D_LOCKS, "MUTEX_LOCK: netdata_mutex_destroy(%p) = %d, from %lu@%s, %s()", mutex, ret, line, file, function); return ret; } int netdata_mutex_lock_debug(const char *file __maybe_unused, const char *function __maybe_unused, const unsigned long line __maybe_unused, netdata_mutex_t *mutex) { - debug(D_LOCKS, "MUTEX_LOCK: netdata_mutex_lock(%p) from %lu@%s, %s()", mutex, line, file, function); + netdata_log_debug(D_LOCKS, "MUTEX_LOCK: netdata_mutex_lock(%p) from %lu@%s, %s()", mutex, line, file, function); usec_t start_s = now_monotonic_high_precision_usec(); int ret = __netdata_mutex_lock(mutex); @@ -167,14 +167,14 @@ int netdata_mutex_lock_debug(const char *file __maybe_unused, const char *functi (void)start_s; (void)end_s; - debug(D_LOCKS, "MUTEX_LOCK: netdata_mutex_lock(%p) = %d in %llu usec, from %lu@%s, %s()", mutex, ret, end_s - start_s, line, file, function); + netdata_log_debug(D_LOCKS, "MUTEX_LOCK: netdata_mutex_lock(%p) = %d in %llu usec, from %lu@%s, %s()", mutex, ret, end_s - start_s, line, file, function); return ret; } int netdata_mutex_trylock_debug(const char *file __maybe_unused, const char *function __maybe_unused, const unsigned long line __maybe_unused, netdata_mutex_t *mutex) { - debug(D_LOCKS, "MUTEX_LOCK: netdata_mutex_trylock(%p) from %lu@%s, %s()", mutex, line, file, function); + netdata_log_debug(D_LOCKS, "MUTEX_LOCK: netdata_mutex_trylock(%p) from %lu@%s, %s()", mutex, line, file, function); usec_t start_s = now_monotonic_high_precision_usec(); int ret = __netdata_mutex_trylock(mutex); @@ -184,14 +184,14 @@ int netdata_mutex_trylock_debug(const char *file __maybe_unused, const char *fun (void)start_s; (void)end_s; - debug(D_LOCKS, "MUTEX_LOCK: netdata_mutex_trylock(%p) = %d in %llu usec, from %lu@%s, %s()", mutex, ret, end_s - start_s, line, file, function); + netdata_log_debug(D_LOCKS, "MUTEX_LOCK: netdata_mutex_trylock(%p) = %d in %llu usec, from %lu@%s, %s()", mutex, ret, end_s - start_s, line, file, function); return ret; } int netdata_mutex_unlock_debug(const char *file __maybe_unused, const char *function __maybe_unused, const unsigned long line __maybe_unused, netdata_mutex_t *mutex) { - debug(D_LOCKS, "MUTEX_LOCK: netdata_mutex_unlock(%p) from %lu@%s, %s()", mutex, line, file, function); + netdata_log_debug(D_LOCKS, "MUTEX_LOCK: netdata_mutex_unlock(%p) from %lu@%s, %s()", mutex, line, file, function); usec_t start_s = now_monotonic_high_precision_usec(); int ret = __netdata_mutex_unlock(mutex); @@ -201,7 +201,7 @@ int netdata_mutex_unlock_debug(const char *file __maybe_unused, const char *func (void)start_s; (void)end_s; - debug(D_LOCKS, "MUTEX_LOCK: netdata_mutex_unlock(%p) = %d in %llu usec, from %lu@%s, %s()", mutex, ret, end_s - start_s, line, file, function); + netdata_log_debug(D_LOCKS, "MUTEX_LOCK: netdata_mutex_unlock(%p) = %d in %llu usec, from %lu@%s, %s()", mutex, ret, end_s - start_s, line, file, function); return ret; } diff --git a/libnetdata/log/log.h b/libnetdata/log/log.h index 53de391d54..22be73d893 100644 --- a/libnetdata/log/log.h +++ b/libnetdata/log/log.h @@ -109,11 +109,11 @@ typedef struct error_with_limit { #define error_limit_static_thread_var(var, log_every_secs, sleep_usecs) static __thread ERROR_LIMIT var = { .last_logged = 0, .count = 0, .log_every = (log_every_secs), .sleep_ut = (sleep_usecs) } #ifdef NETDATA_INTERNAL_CHECKS -#define debug(type, args...) do { if(unlikely(debug_flags & type)) debug_int(__FILE__, __FUNCTION__, __LINE__, ##args); } while(0) +#define netdata_log_debug(type, args...) do { if(unlikely(debug_flags & type)) debug_int(__FILE__, __FUNCTION__, __LINE__, ##args); } while(0) #define internal_error(condition, args...) do { if(unlikely(condition)) error_int(0, "IERR", __FILE__, __FUNCTION__, __LINE__, ##args); } while(0) #define internal_fatal(condition, args...) do { if(unlikely(condition)) fatal_int(__FILE__, __FUNCTION__, __LINE__, ##args); } while(0) #else -#define debug(type, args...) debug_dummy() +#define netdata_log_debug(type, args...) debug_dummy() #define internal_error(args...) debug_dummy() #define internal_fatal(args...) debug_dummy() #endif diff --git a/libnetdata/os.c b/libnetdata/os.c index f0e2411720..e6475a453f 100644 --- a/libnetdata/os.c +++ b/libnetdata/os.c @@ -75,7 +75,7 @@ long get_system_cpus_with_cache(bool cache, bool for_netdata) { if(processors[index] < 1) processors[index] = 1; - debug(D_SYSTEM, "System has %ld processors.", processors[index]); + netdata_log_debug(D_SYSTEM, "System has %ld processors.", processors[index]); return processors[index]; #endif /* __APPLE__, __FreeBSD__ */ diff --git a/libnetdata/popen/popen.c b/libnetdata/popen/popen.c index 48e01056f2..5f8bd2b4a6 100644 --- a/libnetdata/popen/popen.c +++ b/libnetdata/popen/popen.c @@ -384,7 +384,7 @@ int netdata_pclose(FILE *fp_child_input, FILE *fp_child_output, pid_t pid) { int ret; siginfo_t info; - debug(D_EXIT, "Request to netdata_pclose() on pid %d", pid); + netdata_log_debug(D_EXIT, "Request to netdata_pclose() on pid %d", pid); if (fp_child_input) fclose(fp_child_input); diff --git a/libnetdata/procfile/procfile.c b/libnetdata/procfile/procfile.c index dd572e0e7e..1a7e47a56a 100644 --- a/libnetdata/procfile/procfile.c +++ b/libnetdata/procfile/procfile.c @@ -48,11 +48,11 @@ char *procfile_filename(procfile *ff) { // An array of words static inline void procfile_words_add(procfile *ff, char *str) { - // debug(D_PROCFILE, PF_PREFIX ": adding word No %d: '%s'", fw->len, str); + // netdata_log_debug(D_PROCFILE, PF_PREFIX ": adding word No %d: '%s'", fw->len, str); pfwords *fw = ff->words; if(unlikely(fw->len == fw->size)) { - // debug(D_PROCFILE, PF_PREFIX ": expanding words"); + // netdata_log_debug(D_PROCFILE, PF_PREFIX ": expanding words"); size_t minimum = PFWORDS_INCREASE_STEP; size_t optimal = fw->size / 2; size_t wanted = (optimal > minimum)?optimal:minimum; @@ -66,7 +66,7 @@ static inline void procfile_words_add(procfile *ff, char *str) { NEVERNULL static inline pfwords *procfile_words_create(void) { - // debug(D_PROCFILE, PF_PREFIX ": initializing words"); + // netdata_log_debug(D_PROCFILE, PF_PREFIX ": initializing words"); size_t size = (procfile_adaptive_initial_allocation) ? procfile_max_words : PFWORDS_INCREASE_STEP; @@ -77,12 +77,12 @@ static inline pfwords *procfile_words_create(void) { } static inline void procfile_words_reset(pfwords *fw) { - // debug(D_PROCFILE, PF_PREFIX ": resetting words"); + // netdata_log_debug(D_PROCFILE, PF_PREFIX ": resetting words"); fw->len = 0; } static inline void procfile_words_free(pfwords *fw) { - // debug(D_PROCFILE, PF_PREFIX ": freeing words"); + // netdata_log_debug(D_PROCFILE, PF_PREFIX ": freeing words"); freez(fw); } @@ -93,11 +93,11 @@ static inline void procfile_words_free(pfwords *fw) { NEVERNULL static inline size_t *procfile_lines_add(procfile *ff) { - // debug(D_PROCFILE, PF_PREFIX ": adding line %d at word %d", fl->len, first_word); + // netdata_log_debug(D_PROCFILE, PF_PREFIX ": adding line %d at word %d", fl->len, first_word); pflines *fl = ff->lines; if(unlikely(fl->len == fl->size)) { - // debug(D_PROCFILE, PF_PREFIX ": expanding lines"); + // netdata_log_debug(D_PROCFILE, PF_PREFIX ": expanding lines"); size_t minimum = PFLINES_INCREASE_STEP; size_t optimal = fl->size / 2; size_t wanted = (optimal > minimum)?optimal:minimum; @@ -115,7 +115,7 @@ static inline size_t *procfile_lines_add(procfile *ff) { NEVERNULL static inline pflines *procfile_lines_create(void) { - // debug(D_PROCFILE, PF_PREFIX ": initializing lines"); + // netdata_log_debug(D_PROCFILE, PF_PREFIX ": initializing lines"); size_t size = (unlikely(procfile_adaptive_initial_allocation)) ? procfile_max_words : PFLINES_INCREASE_STEP; @@ -126,13 +126,13 @@ static inline pflines *procfile_lines_create(void) { } static inline void procfile_lines_reset(pflines *fl) { - // debug(D_PROCFILE, PF_PREFIX ": resetting lines"); + // netdata_log_debug(D_PROCFILE, PF_PREFIX ": resetting lines"); fl->len = 0; } static inline void procfile_lines_free(pflines *fl) { - // debug(D_PROCFILE, PF_PREFIX ": freeing lines"); + // netdata_log_debug(D_PROCFILE, PF_PREFIX ": freeing lines"); freez(fl); } @@ -144,7 +144,7 @@ static inline void procfile_lines_free(pflines *fl) { void procfile_close(procfile *ff) { if(unlikely(!ff)) return; - debug(D_PROCFILE, PF_PREFIX ": Closing file '%s'", procfile_filename(ff)); + netdata_log_debug(D_PROCFILE, PF_PREFIX ": Closing file '%s'", procfile_filename(ff)); freez(ff->filename); procfile_lines_free(ff->lines); @@ -156,7 +156,7 @@ void procfile_close(procfile *ff) { NOINLINE static void procfile_parser(procfile *ff) { - // debug(D_PROCFILE, PF_PREFIX ": Parsing file '%s'", ff->filename); + // netdata_log_debug(D_PROCFILE, PF_PREFIX ": Parsing file '%s'", ff->filename); char *s = ff->data // our current position , *e = &ff->data[ff->len] // the terminating null @@ -206,7 +206,7 @@ static void procfile_parser(procfile *ff) { (*line_words)++; t = ++s; - // debug(D_PROCFILE, PF_PREFIX ": ended line %d with %d words", l, ff->lines->lines[l].words); + // netdata_log_debug(D_PROCFILE, PF_PREFIX ": ended line %d with %d words", l, ff->lines->lines[l].words); line_words = procfile_lines_add(ff); } @@ -275,7 +275,7 @@ static void procfile_parser(procfile *ff) { } procfile *procfile_readall(procfile *ff) { - // debug(D_PROCFILE, PF_PREFIX ": Reading file '%s'.", ff->filename); + // netdata_log_debug(D_PROCFILE, PF_PREFIX ": Reading file '%s'.", ff->filename); ff->len = 0; // zero the used size ssize_t r = 1; // read at least once @@ -288,12 +288,12 @@ procfile *procfile_readall(procfile *ff) { size_t optimal = ff->size / 2; size_t wanted = (optimal > minimum)?optimal:minimum; - debug(D_PROCFILE, PF_PREFIX ": Expanding data buffer for file '%s' by %zu bytes.", procfile_filename(ff), wanted); + netdata_log_debug(D_PROCFILE, PF_PREFIX ": Expanding data buffer for file '%s' by %zu bytes.", procfile_filename(ff), wanted); ff = reallocz(ff, sizeof(procfile) + ff->si |