.\" Automatically generated man page, do not edit .TH QBLOG.H 3 2020-10-31 "LIBQB" "libqb Programmer's Manual" .SH NAME qblog.h \- The logging API provides four main parts (basics, filtering, threading & blackbox). .SH SYNOPSIS .nf .B #include .SH DESCRIPTION .PP The idea behind this logging system is not to be prescriptive but to provide a set of tools to help the developer achieve what they want quickly and easily. .PP Simplest possible use: .PP To enable a target do the following: .PP syslog, stderr, the blackbox, and stdout are static (they don't need to be created, just enabled or disabled). However, you can open multiple logfiles (falling within inclusive range up to ). To do this, use the following code: .PP Once your targets are enabled/opened, you can configure them as follows: Configure the size of blackbox: .PP Make logging to file threaded: .PP Sometimes, syslog daemons are (pre)configured to filter messages not exceeding a particular priority. When this happens to be the logging target, the designated priority of the message is passed along unchanged, possibly resulting in message loss. For messages up to importance, this can be worked around by proportionally bumping the priorities to be passed to syslog (here, the step is such that gets promoted to ): .PP To ensure all logs to file targets are fsync'ed (new messages expressly transferred to the storage device as they keep coming, otherwise defaults to ): .PP So to make all logs from evil_function() go to stderr, do the following: .PP So to make all logs from totem* (with a priority <= LOG_INFO) go to stderr, do the following: .PP So to make all logs with the substring "ringbuffer" go to stderr, do the following: .PP To achieve non-blocking logging, so that any calls to write() or syslog() will not hold up your program, you can use threaded logging as well. .PP Threaded logging use: .PP Blackbox usage: .PP The code above will produce: .SH NOTE .PP the blackbox is not enabled by default. .SH SEE ALSO .PP .nh .ad l \fIqb_log_filter_fn_set\fR(3), \fIqb_log_thread_start\fR(3), \fIqb_log_target_user_data_get\fR(3), \fIqb_log_tags_stringify_fn_set\fR(3), \fIqb_log_file_reopen\fR(3), \fIqb_log_fini\fR(3), \fIqb_log_callsites_dump\fR(3), \fIqb_log_ctl2\fR(3), \fIqb_log_target_user_data_set\fR(3), \fIqb_log_target_format\fR(3), \fIqb_log_thread_priority_set\fR(3), \fIqb_log_facility2int\fR(3), \fIqb_log_callsites_register\fR(3), \fIqb_log_filter_ctl2\fR(3), \fIqb_log_file_close\fR(3), \fIqb_log_format_set\fR(3), \fIqb_log_real_\fR(3), \fIqb_log_from_external_source_va\fR(3), \fIqb_log_callsite_get\fR(3), \fIqb_log_blackbox_write_to_file\fR(3), \fIqb_log_real_va_\fR(3), \fIqb_log_from_external_source\fR(3), \fIqb_log_blackbox_print_from_file\fR(3), \fIqb_log_facility2str\fR(3), \fIqb_log_ctl\fR(3), \fIqb_log_filter_ctl\fR(3), \fIqb_log_custom_close\fR(3), \fIqb_log_init\fR(3), \fIqb_log_file_open\fR(3), \fIqb_log_custom_open\fR(3) .ad .hy .SH "COPYRIGHT" .PP Copyright (C) 2010-2020 Red Hat, Inc. All rights reserved.