QB_LOG_FORMAT_SET(3)
π QB_LOG_FORMAT_SET(3) π
okay bestie, so this is a page straight out of the libqb Programmer's Manual, and it's literally about making your log messages look cute (or at least look how you want). let's get into it π«Ά
β¨ NAME β¨
qb_log_format_set β Set the format specifiers. that's it, that's the whole job π
πΈ SYNOPSIS πΈ
#include <qb/qblog.h>
void qb_log_format_set(
int32_t t,
const char *format
);
π¦ DESCRIPTION π¦
so you're passing in a format string, and inside it there are these little magic tokens that start with a %. every one of them turns into a piece of info about the log message. it's giving β¨templateβ¨. here's the full roster, no skips, no gatekeeping:
%nβ FUNCTION NAME%fβ FILENAME%lβ FILELINE%pβ PRIORITY%tβ TIMESTAMP%Tβ TIMESTAMP with milliseconds%bβ BUFFER%gβ TAGS%Nβ name (passed intoqb_log_init)%Pβ PID%Hβ hostname
and here's the glow-up detail: any number you put between the % and the character tells it the field length, so it'll pad or chop that field for you. iconic behavior, honestly π
π NOTE π
β οΈ listen up because this one is important β some of these fields are immediately evaluated and remembered for performance reasons. so when your log messages carry PIDs (and no, that is not the default), you have to reinvoke this function afterfork(clone) in the respective children. like, the remembered value won't magically update itself, bestie, it's frozen π. if you're already linking withlibpthread, registering apthread_atforkcallback could be useful for exactly this.
π SEE ALSO π
the whole friend group, fr fr:
qb_log_filter_fn_set(3)qb_log_from_external_source_va2(3)qb_log_thread_start(3)qb_log_target_user_data_get(3)qb_log_tags_stringify_fn_set(3)qb_log_file_reopen(3)qb_log_fini(3)qb_log_callsites_dump(3)qb_log_ctl2(3)qb_log_target_user_data_set(3)qb_log_target_format(3)qb_log_thread_priority_set(3)qb_log_facility2int(3)qb_log_callsites_register(3)qb_log_filter_ctl2(3)qb_log_file_close(3)qb_log_real_(3)qb_log_from_external_source_va(3)qb_log_callsite_get(3)qb_log_blackbox_write_to_file(3)qb_log_real_va_(3)qb_log_from_external_source(3)qb_log_blackbox_print_from_file(3)qb_log_facility2str(3)qb_log_callsite_get2(3)qb_log_ctl(3)qb_log_filter_ctl(3)qb_log_custom_close(3)qb_log_init(3)qb_log_file_open(3)qb_log_custom_open(3)
π COPYRIGHT π
Copyright (c) 2017 Red Hat, Inc.
and that's the whole page bestie, you ate that π ok bye, this was LIBQB, version dated 2025-09-16, and it's QB_LOG_FORMAT_SET(3) β go format something gorgeous β¨π
π¦ where this page comes from
- fedora 44: libqb-devel 2.0.9-2.fc44 Β· LGPL-2.1-or-later
- fedora 44: libqb-devel 2.0.9-2.fc44 Β· LGPL-2.1-or-later
- ubuntu resolute: libqb-dev 2.0.9-1ubuntu1 Β· LGPL-2.1-or-later
- ubuntu stonking: libqb-dev 2.0.9-1ubuntu1 Β· LGPL-2.1-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms