]> www.infradead.org Git - users/sagi/libnvme.git/commitdiff
log: Respect DEFAULT_LOGLEVEL on uninitialized logging
authorTomas Bzatek <tbzatek@redhat.com>
Thu, 15 Feb 2024 14:21:20 +0000 (09:21 -0500)
committerDaniel Wagner <wagi@monom.org>
Wed, 6 Mar 2024 09:56:14 +0000 (10:56 +0100)
When logging has not been initialized and no root available,
logging via nvme_msg() would just print everything. Better
to check against DEFAULT_LOGLEVEL in such cases.

Signed-off-by: Tomas Bzatek <tbzatek@redhat.com>
src/nvme/log.c

index 8df411cd95820426ddd8d7bb1b64e8eed698536d..c98d2135fb98ea4fe25a7969c923f952b58d3d53 100644 (file)
@@ -58,6 +58,8 @@ __nvme_msg(nvme_root_t r, int lvl,
 
        if (r && lvl > r->log_level)
                return;
+       if (!r && lvl > DEFAULT_LOGLEVEL)
+               return;
 
        if (r && r->log_timestamp) {
                struct timespec now;