10 #ifndef PCMK__CRM_COMMON_LOGGING_INTERNAL__H 11 #define PCMK__CRM_COMMON_LOGGING_INTERNAL__H 50 #define pcmk__warn_once(wo_flag, fmt...) do { \ 51 if (!pcmk_is_set(pcmk__warnings, wo_flag)) { \ 52 if (wo_flag == pcmk__wo_blind) { \ 55 pcmk__config_warn(fmt); \ 57 pcmk__warnings = pcmk__set_flags_as(__func__, __LINE__, \ 59 "Warn-once", "logging", \ 61 (wo_flag), #wo_flag); \ 95 #define pcmk__config_err(fmt...) do { \ 96 pcmk__config_has_error = true; \ 97 if (pcmk__config_error_handler == NULL) { \ 100 pcmk__config_error_handler(pcmk__config_error_context, fmt); \ 110 #define pcmk__config_warn(fmt...) do { \ 111 pcmk__config_has_warning = true; \ 112 if (pcmk__config_warning_handler == NULL) { \ 115 pcmk__config_warning_handler(pcmk__config_warning_context, fmt);\ 132 #define pcmk__if_tracing(if_action, else_action) do { \ 133 static struct qb_log_callsite *trace_cs = NULL; \ 135 if (trace_cs == NULL) { \ 136 trace_cs = qb_log_callsite_get(__func__, __FILE__, \ 137 "if_tracing", LOG_TRACE, \ 138 __LINE__, crm_trace_nonlog); \ 140 if (crm_is_callsite_active(trace_cs, LOG_TRACE, \ 141 crm_trace_nonlog)) { \ 157 #define pcmk__log_xml_changes(level, xml) do { \ 158 uint8_t _level = pcmk__clip_log_level(level); \ 159 static struct qb_log_callsite *xml_cs = NULL; \ 166 if (xml_cs == NULL) { \ 167 xml_cs = qb_log_callsite_get(__func__, __FILE__, \ 168 "xml-changes", _level, \ 171 if (crm_is_callsite_active(xml_cs, _level, 0)) { \ 172 pcmk__log_xml_changes_as(__FILE__, __func__, __LINE__, \ 188 #define pcmk__log_xml_patchset(level, patchset) do { \ 189 uint8_t _level = pcmk__clip_log_level(level); \ 190 static struct qb_log_callsite *xml_cs = NULL; \ 197 if (xml_cs == NULL) { \ 198 xml_cs = qb_log_callsite_get(__func__, __FILE__, \ 199 "xml-patchset", _level, \ 202 if (crm_is_callsite_active(xml_cs, _level, 0)) { \ 203 pcmk__log_xml_patchset_as(__FILE__, __func__, __LINE__, \ 204 0, _level, patchset); \ 211 uint32_t line, uint32_t tags, uint8_t level,
215 uint32_t line, uint32_t tags, uint8_t level,
216 const xmlNode *patchset);
238 #endif // PCMK__CRM_COMMON_LOGGING_INTERNAL__H
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
bool pcmk__config_has_error
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
bool pcmk__config_has_warning
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)