14 #ifndef PCMK__LOGGING_INTERNAL_H 15 #define PCMK__LOGGING_INTERNAL_H 65 #define pcmk__warn_once(wo_flag, fmt...) do { \ 66 if (!pcmk_is_set(pcmk__warnings, wo_flag)) { \ 67 if (wo_flag == pcmk__wo_blind) { \ 70 pcmk__config_warn(fmt); \ 72 pcmk__warnings = pcmk__set_flags_as(__func__, __LINE__, \ 74 "Warn-once", "logging", \ 76 (wo_flag), #wo_flag); \ 100 #define pcmk__config_err(fmt...) do { \ 101 crm_config_error = TRUE; \ 102 if (pcmk__config_error_handler == NULL) { \ 105 pcmk__config_error_handler(pcmk__config_error_context, fmt); \ 115 #define pcmk__config_warn(fmt...) do { \ 116 crm_config_warning = TRUE; \ 117 if (pcmk__config_warning_handler == NULL) { \ 120 pcmk__config_warning_handler(pcmk__config_warning_context, fmt);\ 137 #define pcmk__if_tracing(if_action, else_action) do { \ 138 static struct qb_log_callsite *trace_cs = NULL; \ 140 if (trace_cs == NULL) { \ 141 trace_cs = qb_log_callsite_get(__func__, __FILE__, \ 142 "if_tracing", LOG_TRACE, \ 143 __LINE__, crm_trace_nonlog); \ 145 if (crm_is_callsite_active(trace_cs, LOG_TRACE, \ 146 crm_trace_nonlog)) { \ 162 #define pcmk__log_xml_changes(level, xml) do { \ 163 uint8_t _level = pcmk__clip_log_level(level); \ 164 static struct qb_log_callsite *xml_cs = NULL; \ 171 if (xml_cs == NULL) { \ 172 xml_cs = qb_log_callsite_get(__func__, __FILE__, \ 173 "xml-changes", _level, \ 176 if (crm_is_callsite_active(xml_cs, _level, 0)) { \ 177 pcmk__log_xml_changes_as(__FILE__, __func__, __LINE__, \ 193 #define pcmk__log_xml_patchset(level, patchset) do { \ 194 uint8_t _level = pcmk__clip_log_level(level); \ 195 static struct qb_log_callsite *xml_cs = NULL; \ 202 if (xml_cs == NULL) { \ 203 xml_cs = qb_log_callsite_get(__func__, __FILE__, \ 204 "xml-patchset", _level, \ 207 if (crm_is_callsite_active(xml_cs, _level, 0)) { \ 208 pcmk__log_xml_patchset_as(__FILE__, __func__, __LINE__, \ 209 0, _level, patchset); \ 216 uint32_t line, uint32_t tags, uint8_t level,
220 uint32_t line, uint32_t tags, uint8_t level,
221 const xmlNode *patchset);
void(*) typedef void(* pcmk__config_warning_func)(void *ctx, const char *msg,...) G_GNUC_PRINTF(2
void * pcmk__config_error_context
int pcmk__add_logfile(const char *filename)
Add a file to be used as a Pacemaker detail log.
void pcmk__free_common_logger(void)
Wrappers for and extensions to libqb logging.
void pcmk__set_config_warning_handler(pcmk__config_warning_func warning_handler, void *warning_context)
Formatted output for pacemaker tools.
pcmk__config_warning_func pcmk__config_warning_handler
void pcmk__log_xml_patchset_as(const char *file, const char *function, uint32_t line, uint32_t tags, uint8_t level, const xmlNode *patchset)
void * pcmk__config_warning_context
void pcmk__cli_init_logging(const char *name, unsigned int verbosity)
void(* pcmk__config_error_func)(void *ctx, const char *msg,...) G_GNUC_PRINTF(2
void(*) typedef void(*) pcmk__config_error_fun pcmk__config_error_handler)
This structure contains everything that makes up a single output formatter.
void pcmk__log_xml_changes_as(const char *file, const char *function, uint32_t line, uint32_t tags, uint8_t level, const xmlNode *xml)
void pcmk__add_logfiles(gchar **log_files, pcmk__output_t *out)
Add multiple additional log files.
void pcmk__set_config_error_handler(pcmk__config_error_func error_handler, void *error_context)