pacemaker
1.1.18-7fdfbbe
Scalable High-Availability cluster resource manager
|
Go to the source code of this file.
Macros | |
#define | CRM_XML_LOG_BASE(priority, dechunk, postemit, prefix, fmt, ap) |
Base for directing lib{xml2,xslt} log into standard libqb backend. More... | |
#define CRM_XML_LOG_BASE | ( | priority, | |
dechunk, | |||
postemit, | |||
prefix, | |||
fmt, | |||
ap | |||
) |
Base for directing lib{xml2,xslt} log into standard libqb backend.
This macro implements the core of what can be needed for directing libxml2 or libxslt error messaging into standard, preconfigured libqb-backed log stream.
It's a bit unfortunate that libxml2 (and more sparsely, also libxslt) emits a single message by chunks (location is emitted separatedly from the message itself), so we have to take the effort to combine these chunks back to single message. Whether to do this or not is driven with dechunk
toggle.
The form of a macro was chosen for implicit deriving of FILE, etc. and also because static dechunking buffer should be differentiated per library (here we assume different functions referring to this macro will not ever be using both at once), preferably also per-library context of use to avoid clashes altogether.
Note that we cannot use qb_logt, because callsite data have to be known at the moment of compilation, which it is not always the case – xml_log (and unfortunately there's no clear explanation of the fail to compile).
Also note that there's no explicit guard against said libraries producing never-newline-terminated chunks (which would just keep consuming memory), as it's quite improbable. Termination of the program in between the same-message chunks will raise a flag with valgrind and the likes, though.
[in] | priority | Syslog priority for the message to be logged |
[in] | dechunk | Whether to dechunk new-line terminated message |
[in] | postemit | Code to be executed once message is sent out |
[in] | prefix | How to prefix the message or NULL for raw passing |
[in] | fmt | Format string as with printf-like functions |
[in] | ap | Variable argument list to supplement fmt format string |
Definition at line 67 of file xml_internal.h.