Under the influence of libxml2 and considering that actual "patch"
information in fact, if significant, ends up encoded in QB_VER_REST,
shift away from convention codified, e.g., by semver.org (not adored
by libqb, anyway) and rename designated PATCH component of the version
to MICRO accordingly.
Note that at this point, after a release without any header-based
versioning present and just a few commits after it was tentatively
introduced, it's a painless change. Once this PATCH nomenclature
is leaked into a full release, there's no way to get rid of it
reasonably...
Mainly as a light-weight alternative to full-blown autoconf/pkg-config
machineries, whereby one can:
* workaround functionality not present in libqb up to 1.0 (inclusive)
- note that this versioning schema is being introduced *after*
1.0.0 release so one cannot tell that version from any older,
but will be able to safely identify any later one (1.0.1+)
and act accordingly
- example:
#if !defined(QB_VER_MAJOR) || ((QB_VER_MAJOR == 1) && (QB_VER_MINOR < 1))
#warning "Feature X not supported"
int do_foo(int arg) { };
#else
int
do_foo(int arg)
{
/* use feature X of libqb */
}
#endif
* make its program report libqb API version it was built with by
emitting QB_VER_STR symbolic string (see tests/print_ver.c for example)
Also added is a print_ver test program to:
* emit how original unparsed version is parsed to particular components
defined in qbconfig.h (QB_VER_{MAJOR,MINOR,PATCH} symbolic integer
constants and QB_VER_REST symbolic string) when being compiled
* emit mentioned QB_VER_STR symbolic string joining the components
back to a single string, plus the components themselves
Resolves: https://github.com/ClusterLabs/libqb/issues/186
Original "qb_log_ctl" interface had to be extended for passing read-only
strings (new parameter), resulting in new "qb_log_ctl2" function, which
is what qb_log_ctl calls into with the new parameter set to NULL.
This ensures backward compatibility.
A new QB_LOG_CONF_IDENT configuration directive for the mentioned
interface is added with a goal to set new internal identifier
that is, notably, used for syslog sink. This allows for switching
the identification without a need to reinitialize logging subsystem,
akin to changing target logging facility.
Also a brand new concept of testing syslog sink in particular is
introduced (finally). During initial trial&error stage, it used
LD_PRELOAD hack but it seems that libtool is sophisticated enough
that no such extra intervention is needed and the desired symbol
resolution Just Works (tm). However, the technique is highly
non-portable (there is even a warning about that from libtool,
which is partially on purpose as the _syslog_override.so should
rather be explicit it is by no mean a regular library) and hence
the syslog tests have to be enabled with explicit
./configure --enable-syslog-tests
rather than possibly break on untested platforms (far too many).
The concept can be extended upon, but initially, just the new
feature is being tested.
Post-review: thanks Chrissie for a suggestion how to deal with
extract-arg-and-forget in a less intrusive way (no defines).
- use semicolons at the end of the description
- use commas when there can be an issue with parsing a long sentence
(and wrap such text at 79 characters if applicable)
Also use the new enum qb_log_target_slot type in for-loops together
with a proper substitute for the literal "0" initializer.
There could be more places that might be type-substituted for this enum
(and hence possibly catch more of an incorrect usage if the compiler
or checker has some notion of enum type narrowing), but leave it as
a possible enhancement for now.
The format strings for QB_HDB_D_FORMAT & QB_HDB_X_FORMAT had no spaces
between "%" and PRIx64. This is allowed, but technically incorrect and
breaks C++11
Signed-off-by: Christine Caulfield <ccaulfie@redhat.com>
If a log message contains a magic character, everything after that marker
will be considered "extended" information. Log targets default to showing
this extended information but qb_log_ctl() may be used to indicate that
the extended information should be stripped instead.
The use case is a log message that has some information of value to administrators
and other information that is only of value for debugging. Two targets can be
configured such that the administrator log is not cluttered with debug information,
but a separate debug log is still available with complete information.
The magic character is the bell (\a). If someone wants to log an actual bell
character, they can do so in the extended information or via a %c format
(only the first bell is magic and only in the format string).
When server side buffer limits are in use, this is
necessary to determine the buffer size the server
is enforcing after the client connection is established.
This is just a re-work of Steve's sample patch.
You set the number of splits and whether they overwrite using
qb_util_stopwatch_split_ctl().
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
At the moment if you have multiple notifiers it becomes impossible
to figure out when it is safe to free the values.
This new callback can only be added once and is called
once, making it better suited to freeing memory. It is
also called after the deleted and replaced notifiers.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
This allows you to match on the same fields that you provided
in the add. Now including the userdata.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>