diff options
author | Ilya Mashchenko <ilya@netdata.cloud> | 2024-02-05 18:38:31 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-02-05 18:38:31 +0200 |
commit | 85b274833bb01e5bdef3e230f4f2e7ec6c8f26e5 (patch) | |
tree | 8edb6aa2e5f490f6691dceefb2f7d71f83697d3b /src | |
parent | 8920bcbfc18cdeec4b8fd91c3756032e00ccc32b (diff) |
respect log level for all sources (#16922)
Diffstat (limited to 'src')
-rw-r--r-- | src/libnetdata/log/log.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/libnetdata/log/log.c b/src/libnetdata/log/log.c index e7edd5c524..ab8c201972 100644 --- a/src/libnetdata/log/log.c +++ b/src/libnetdata/log/log.c @@ -661,8 +661,10 @@ void nd_log_set_priority_level(const char *setting) { priority = NDLP_DEBUG; #endif - nd_log.sources[NDLS_DAEMON].min_priority = priority; - nd_log.sources[NDLS_COLLECTORS].min_priority = priority; + for (size_t i = 0; i < _NDLS_MAX; i++) { + if (i != NDLS_DEBUG) + nd_log.sources[i].min_priority = priority; + } // the right one setenv("NETDATA_LOG_LEVEL", nd_log_id2priority(priority), 1); @@ -2252,7 +2254,7 @@ void netdata_logger(ND_LOG_SOURCES source, ND_LOG_FIELD_PRIORITY priority, const int saved_errno = errno; source = nd_log_validate_source(source); - if((source == NDLS_DAEMON || source == NDLS_COLLECTORS) && priority > nd_log.sources[source].min_priority) + if (source != NDLS_DEBUG && priority > nd_log.sources[source].min_priority) return; va_list args; @@ -2267,6 +2269,9 @@ void netdata_logger_with_limit(ERROR_LIMIT *erl, ND_LOG_SOURCES source, ND_LOG_F int saved_errno = errno; source = nd_log_validate_source(source); + if (source != NDLS_DEBUG && priority > nd_log.sources[source].min_priority) + return; + if(erl->sleep_ut) sleep_usec(erl->sleep_ut); |