QB_LOG_FILTER_FN_SET(3)

💖 QB_LOG_FILTER_FN_SET(3) 💖

okay bestie, this one's from the libqb Programmer's Manual and it's giving "I do it myself" energy, and honestly? iconic.


✨ NAME ✨

qb_log_filter_fn_set — so like, instead of using the qb_log_filter_ctl() functions, you can apply the filters manually by defining a callback and setting the targets field using qb_bit_set() and qb_bit_clear() like the following below:

🌸 SYNOPSIS 🌸

#include <qb/qblog.h>

int32_t qb_log_filter_fn_set(
    qb_log_filter_fn  fn
);

🦋 DESCRIPTION 🦋

here's the whole vibe, literally the example straight up:

static void
m_filter(struct qb_log_callsite *cs)
{
        if ((cs->priority >= LOG_ALERT &&
             cs->priority <= LOG_DEBUG) &&
             strcmp(cs->filename, "my_c_file.c") == 0) {
                qb_bit_set(cs->targets, QB_LOG_SYSLOG);
        } else {
                qb_bit_clear(cs->targets, QB_LOG_SYSLOG);
        }
}

so you hand over your fn, and you are the main character deciding what happens to cs->targets. no cap. 💅

👑 SEE ALSO 👑

Copyright (c) 2017 Red Hat, Inc.


and that's the whole page bestie 🫶 this came out under LIBQB on 2025-09-16, and the manual name up top was QB_LOG_FILTER_FN_SET(3) — slay, go write ur filter, ily 💜✨

📦 where this page comes from