1QBLOG.H(3)                 libqb Programmer's Manual                QBLOG.H(3)
2
3
4

NAME

6       qblog.h
7

SYNOPSIS

9       #include <qb/qblog.h>
10

DESCRIPTION

12       The  logging API provides four main parts (basics, filtering, threading
13       & blackbox).
14
15       The idea behind this logging system is not to be  prescriptive  but  to
16       provide  a  set  of  tools to help the developer achieve what they want
17       quickly and easily.
18
19       Simplest possible use:
20
21       To enable a target do the following:
22
23       syslog, stderr, the blackbox, and stdout are static (they don't need to
24       be  created,  just enabled or disabled). However, you can open multiple
25       logfiles (falling within inclusive range  up to ). To do this, use  the
26       following code:
27
28       Once  your  targets  are enabled/opened, you can configure them as fol‐
29       lows: Configure the size of blackbox:
30
31       Make logging to file threaded:
32
33       Sometimes, syslog daemons are (pre)configured to  filter  messages  not
34       exceeding  a  particular  priority. When this happens to be the logging
35       target,  the  designated  priority  of  the  message  is  passed  along
36       unchanged,  possibly  resulting  in  message  loss.  For messages up to
37       importance, this can be worked around  by  proportionally  bumping  the
38       priorities  to  be  passed to syslog (here, the step is such that  gets
39       promoted to ):
40
41       To ensure all logs to file targets are fsync'ed (new messages expressly
42       transferred  to  the  storage  device  as  they  keep coming, otherwise
43       defaults to ):
44
45       So to make all logs from evil_function() go to stderr, do  the  follow‐
46       ing:
47
48       So  to  make  all  logs from totem* (with a priority <= LOG_INFO) go to
49       stderr, do the following:
50
51       So to make all logs with the substring "ringbuffer" go  to  stderr,  do
52       the following:
53
54       To  achieve  non-blocking logging, so that any calls to write() or sys‐
55       log() will not hold up your program, you can use  threaded  logging  as
56       well.
57
58       Threaded logging use:
59
60       Blackbox usage:
61
62        The code above will produce:
63

NOTE

65       the blackbox is not enabled by default.
66

SEE ALSO

68       qb_log_filter_fn_set(3), qb_log_thread_start(3),
69       qb_log_target_user_data_get(3), qb_log_tags_stringify_fn_set(3),
70       qb_log_file_reopen(3), qb_log_fini(3), qb_log_callsites_dump(3),
71       qb_log_ctl2(3), qb_log_target_user_data_set(3),
72       qb_log_target_format(3), qb_log_thread_priority_set(3),
73       qb_log_facility2int(3), qb_log_callsites_register(3),
74       qb_log_filter_ctl2(3), qb_log_file_close(3), qb_log_format_set(3),
75       qb_log_real_(3), qb_log_from_external_source_va(3),
76       qb_log_callsite_get(3), qb_log_blackbox_write_to_file(3),
77       qb_log_real_va_(3), qb_log_from_external_source(3),
78       qb_log_blackbox_print_from_file(3), qb_log_facility2str(3),
79       qb_log_ctl(3), qb_log_filter_ctl(3), qb_log_custom_close(3),
80       qb_log_init(3), qb_log_file_open(3), qb_log_custom_open(3)
81
83       Copyright (C) 2010-2020 Red Hat, Inc. All rights reserved.
84
85
86
87LIBQB                             2020-07-30                        QBLOG.H(3)
Impressum