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); \
98#define pcmk__config_err(fmt...) do { \
99 crm_config_error = TRUE; \
100 if (pcmk__config_error_handler == NULL) { \
103 pcmk__config_error_handler(pcmk__config_error_context, fmt); \
113#define pcmk__config_warn(fmt...) do { \
114 crm_config_warning = TRUE; \
115 if (pcmk__config_warning_handler == NULL) { \
118 pcmk__config_warning_handler(pcmk__config_warning_context, fmt);\
135#define pcmk__if_tracing(if_action, else_action) do { \
136 static struct qb_log_callsite *trace_cs = NULL; \
138 if (trace_cs == NULL) { \
139 trace_cs = qb_log_callsite_get(__func__, __FILE__, \
140 "if_tracing", LOG_TRACE, \
141 __LINE__, crm_trace_nonlog); \
143 if (crm_is_callsite_active(trace_cs, LOG_TRACE, \
144 crm_trace_nonlog)) { \
160#define pcmk__log_xml_changes(level, xml) do { \
161 uint8_t _level = pcmk__clip_log_level(level); \
162 static struct qb_log_callsite *xml_cs = NULL; \
169 if (xml_cs == NULL) { \
170 xml_cs = qb_log_callsite_get(__func__, __FILE__, \
171 "xml-changes", _level, \
174 if (crm_is_callsite_active(xml_cs, _level, 0)) { \
175 pcmk__log_xml_changes_as(__FILE__, __func__, __LINE__, \
191#define pcmk__log_xml_patchset(level, patchset) do { \
192 uint8_t _level = pcmk__clip_log_level(level); \
193 static struct qb_log_callsite *xml_cs = NULL; \
200 if (xml_cs == NULL) { \
201 xml_cs = qb_log_callsite_get(__func__, __FILE__, \
202 "xml-patchset", _level, \
205 if (crm_is_callsite_active(xml_cs, _level, 0)) { \
206 pcmk__log_xml_patchset_as(__FILE__, __func__, __LINE__, \
207 0, _level, patchset); \
214 uint32_t line, uint32_t tags, uint8_t level,
218 uint32_t line, uint32_t tags, uint8_t level,
219 const xmlNode *patchset);
Wrappers for and extensions to libqb logging.
void(* pcmk__config_warning_func)(void *ctx, const char *msg,...)
int pcmk__add_logfile(const char *filename)
Add a file to be used as a Pacemaker detail log.
void pcmk__free_common_logger(void)
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__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)
void(* pcmk__config_error_func)(void *ctx, const char *msg,...)
void pcmk__set_config_warning_handler(pcmk__config_warning_func warning_handler, void *warning_context)
void * pcmk__config_error_context
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__cli_init_logging(const char *name, unsigned int verbosity)
@ pcmk__wo_instance_defaults
@ pcmk__wo_master_element
@ pcmk__wo_location_rules
@ pcmk__wo_multiple_rules
@ pcmk__wo_clone_master_max
@ pcmk__wo_clone_master_node_max
pcmk__config_error_func pcmk__config_error_handler
Formatted output for pacemaker tools.
This structure contains everything that makes up a single output formatter.