pacemaker  2.1.9-49aab99839
Scalable High-Availability cluster resource manager
Macros | Typedefs | Enumerations | Functions | Variables
logging_internal.h File Reference
#include <glib.h>
#include <crm/common/logging.h>
#include <crm/common/output_internal.h>
Include dependency graph for logging_internal.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define PCMK__LOGGING_INTERNAL_H
 
#define pcmk__warn_once(wo_flag, fmt...)
 
#define pcmk__config_err(fmt...)
 
#define pcmk__config_warn(fmt...)
 
#define pcmk__if_tracing(if_action, else_action)
 
#define pcmk__log_xml_changes(level, xml)
 
#define pcmk__log_xml_patchset(level, patchset)
 

Typedefs

typedef void(* pcmk__config_error_func) (void *ctx, const char *msg,...) G_GNUC_PRINTF(2
 
typedef void(*) typedef void(* pcmk__config_warning_func) (void *ctx, const char *msg,...) G_GNUC_PRINTF(2
 
typedef void(*) typedef void(*) pcmk__config_error_fun pcmk__config_error_handler)
 

Enumerations

enum  pcmk__warnings {
  pcmk__wo_blind = (1 << 0), pcmk__wo_restart_type = (1 << 1), pcmk__wo_role_after = (1 << 2), pcmk__wo_poweroff = (1 << 3),
  pcmk__wo_require_all = (1 << 4), pcmk__wo_order_score = (1 << 5), pcmk__wo_neg_threshold = (1 << 6), pcmk__wo_remove_after = (1 << 7),
  pcmk__wo_ping_node = (1 << 8), pcmk__wo_order_inst = (1 << 9), pcmk__wo_coloc_inst = (1 << 10), pcmk__wo_group_order = (1 << 11),
  pcmk__wo_group_coloc = (1 << 12), pcmk__wo_upstart = (1 << 13), pcmk__wo_nagios = (1 << 14), pcmk__wo_set_ordering = (1 << 15),
  pcmk__wo_rdisc_enabled = (1 << 16), pcmk__wo_rkt = (1 << 17), pcmk__wo_location_rules = (1 << 18), pcmk__wo_op_attr_expr = (1 << 19),
  pcmk__wo_instance_defaults = (1 << 20), pcmk__wo_multiple_rules = (1 << 21), pcmk__wo_master_element = (1 << 22), pcmk__wo_clone_master_max = (1 << 23),
  pcmk__wo_clone_master_node_max = (1 << 24), pcmk__wo_bundle_master = (1 << 25), pcmk__wo_master_role = (1 << 26), pcmk__wo_slave_role = (1 << 27)
}
 

Functions

void pcmk__set_config_error_handler (pcmk__config_error_func error_handler, void *error_context)
 
void pcmk__set_config_warning_handler (pcmk__config_warning_func warning_handler, void *warning_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__log_xml_patchset_as (const char *file, const char *function, uint32_t line, uint32_t tags, uint8_t level, const xmlNode *patchset)
 
void pcmk__cli_init_logging (const char *name, unsigned int verbosity)
 
int pcmk__add_logfile (const char *filename)
 Add a file to be used as a Pacemaker detail log. More...
 
void pcmk__add_logfiles (gchar **log_files, pcmk__output_t *out)
 Add multiple additional log files. More...
 
void pcmk__free_common_logger (void)
 

Variables

pcmk__config_warning_func pcmk__config_warning_handler
 
void * pcmk__config_error_context
 
void * pcmk__config_warning_context
 

Macro Definition Documentation

◆ pcmk__config_err

#define pcmk__config_err (   fmt...)
Value:
do { \
crm_config_error = TRUE; \
if (pcmk__config_error_handler == NULL) { \
crm_err(fmt); \
} else { \
pcmk__config_error_handler(pcmk__config_error_context, fmt); \
} \
} while (0)
void * pcmk__config_error_context
Definition: logging.c:56
void(*) typedef void(*) pcmk__config_error_fun pcmk__config_error_handler)

Definition at line 100 of file logging_internal.h.

◆ pcmk__config_warn

#define pcmk__config_warn (   fmt...)
Value:
do { \
crm_config_warning = TRUE; \
crm_warn(fmt); \
} else { \
pcmk__config_warning_handler(pcmk__config_warning_context, fmt);\
} \
} while (0)
pcmk__config_warning_func pcmk__config_warning_handler
Definition: logging.c:55
void * pcmk__config_warning_context
Definition: logging.c:57

Definition at line 115 of file logging_internal.h.

◆ pcmk__if_tracing

#define pcmk__if_tracing (   if_action,
  else_action 
)
Value:
do { \
static struct qb_log_callsite *trace_cs = NULL; \
\
if (trace_cs == NULL) { \
trace_cs = qb_log_callsite_get(__func__, __FILE__, \
"if_tracing", LOG_TRACE, \
__LINE__, crm_trace_nonlog); \
} \
if_action; \
} else { \
else_action; \
} \
} while (0)
#define LOG_TRACE
Definition: logging.h:38
unsigned int crm_trace_nonlog
Definition: logging.c:46
gboolean crm_is_callsite_active(struct qb_log_callsite *cs, uint8_t level, uint32_t tags)
Definition: logging.c:680

Definition at line 137 of file logging_internal.h.

◆ pcmk__log_xml_changes

#define pcmk__log_xml_changes (   level,
  xml 
)
Value:
do { \
uint8_t _level = pcmk__clip_log_level(level); \
static struct qb_log_callsite *xml_cs = NULL; \
\
switch (_level) { \
case LOG_STDOUT: \
case LOG_NEVER: \
break; \
default: \
if (xml_cs == NULL) { \
xml_cs = qb_log_callsite_get(__func__, __FILE__, \
"xml-changes", _level, \
__LINE__, 0); \
} \
if (crm_is_callsite_active(xml_cs, _level, 0)) { \
pcmk__log_xml_changes_as(__FILE__, __func__, __LINE__, \
0, _level, xml); \
} \
break; \
} \
} while(0)
#define LOG_NEVER
Definition: logging.h:48
gboolean crm_is_callsite_active(struct qb_log_callsite *cs, uint8_t level, uint32_t tags)
Definition: logging.c:680
#define LOG_STDOUT
Definition: logging.h:43

Definition at line 162 of file logging_internal.h.

◆ pcmk__log_xml_patchset

#define pcmk__log_xml_patchset (   level,
  patchset 
)
Value:
do { \
uint8_t _level = pcmk__clip_log_level(level); \
static struct qb_log_callsite *xml_cs = NULL; \
\
switch (_level) { \
case LOG_STDOUT: \
case LOG_NEVER: \
break; \
default: \
if (xml_cs == NULL) { \
xml_cs = qb_log_callsite_get(__func__, __FILE__, \
"xml-patchset", _level, \
__LINE__, 0); \
} \
if (crm_is_callsite_active(xml_cs, _level, 0)) { \
pcmk__log_xml_patchset_as(__FILE__, __func__, __LINE__, \
0, _level, patchset); \
} \
break; \
} \
} while(0)
#define LOG_NEVER
Definition: logging.h:48
gboolean crm_is_callsite_active(struct qb_log_callsite *cs, uint8_t level, uint32_t tags)
Definition: logging.c:680
#define LOG_STDOUT
Definition: logging.h:43

Definition at line 193 of file logging_internal.h.

◆ PCMK__LOGGING_INTERNAL_H

#define PCMK__LOGGING_INTERNAL_H

Definition at line 15 of file logging_internal.h.

◆ pcmk__warn_once

#define pcmk__warn_once (   wo_flag,
  fmt... 
)
Value:
do { \
if (!pcmk_is_set(pcmk__warnings, wo_flag)) { \
if (wo_flag == pcmk__wo_blind) { \
crm_warn(fmt); \
} else { \
pcmk__config_warn(fmt); \
} \
pcmk__warnings = pcmk__set_flags_as(__func__, __LINE__, \
"Warn-once", "logging", \
(wo_flag), #wo_flag); \
} \
} while (0)
#define LOG_TRACE
Definition: logging.h:38
pcmk__warnings
#define pcmk_is_set(g, f)
Convenience alias for pcmk_all_flags_set(), to check single flag.
Definition: util.h:94

Definition at line 65 of file logging_internal.h.

Typedef Documentation

◆ pcmk__config_error_func

typedef void(* pcmk__config_error_func) (void *ctx, const char *msg,...) G_GNUC_PRINTF(2

Definition at line 80 of file logging_internal.h.

◆ pcmk__config_error_handler

typedef void(*) typedef void(*) pcmk__config_error_fun pcmk__config_error_handler)

◆ pcmk__config_warning_func

typedef void(*) typedef void(* pcmk__config_warning_func) (void *ctx, const char *msg,...) G_GNUC_PRINTF(2

Definition at line 82 of file logging_internal.h.

Enumeration Type Documentation

◆ pcmk__warnings

Enumerator
pcmk__wo_blind 
pcmk__wo_restart_type 
pcmk__wo_role_after 
pcmk__wo_poweroff 
pcmk__wo_require_all 
pcmk__wo_order_score 
pcmk__wo_neg_threshold 
pcmk__wo_remove_after 
pcmk__wo_ping_node 
pcmk__wo_order_inst 
pcmk__wo_coloc_inst 
pcmk__wo_group_order 
pcmk__wo_group_coloc 
pcmk__wo_upstart 
pcmk__wo_nagios 
pcmk__wo_set_ordering 
pcmk__wo_rdisc_enabled 
pcmk__wo_rkt 
pcmk__wo_location_rules 
pcmk__wo_op_attr_expr 
pcmk__wo_instance_defaults 
pcmk__wo_multiple_rules 
pcmk__wo_master_element 
pcmk__wo_clone_master_max 
pcmk__wo_clone_master_node_max 
pcmk__wo_bundle_master 
pcmk__wo_master_role 
pcmk__wo_slave_role 

Definition at line 27 of file logging_internal.h.

Function Documentation

◆ pcmk__add_logfile()

int pcmk__add_logfile ( const char *  filename)

Add a file to be used as a Pacemaker detail log.

Parameters
[in]filenameName of log file to use
Returns
Standard Pacemaker return code

Definition at line 317 of file logging.c.

◆ pcmk__add_logfiles()

void pcmk__add_logfiles ( gchar **  log_files,
pcmk__output_t out 
)

Add multiple additional log files.

Parameters
[in]log_filesArray of log files to add
[in]outOutput object to use for error reporting
Returns
Standard Pacemaker return code

Definition at line 401 of file logging.c.

◆ pcmk__cli_init_logging()

void pcmk__cli_init_logging ( const char *  name,
unsigned int  verbosity 
)

Definition at line 1135 of file logging.c.

◆ pcmk__free_common_logger()

void pcmk__free_common_logger ( void  )

Definition at line 1251 of file logging.c.

◆ pcmk__log_xml_changes_as()

void pcmk__log_xml_changes_as ( const char *  file,
const char *  function,
uint32_t  line,
uint32_t  tags,
uint8_t  level,
const xmlNode *  xml 
)

Definition at line 1198 of file logging.c.

◆ pcmk__log_xml_patchset_as()

void pcmk__log_xml_patchset_as ( const char *  file,
const char *  function,
uint32_t  line,
uint32_t  tags,
uint8_t  level,
const xmlNode *  patchset 
)

Definition at line 1229 of file logging.c.

◆ pcmk__set_config_error_handler()

void pcmk__set_config_error_handler ( pcmk__config_error_func  error_handler,
void *  error_context 
)

Definition at line 1287 of file logging.c.

◆ pcmk__set_config_warning_handler()

void pcmk__set_config_warning_handler ( pcmk__config_warning_func  warning_handler,
void *  warning_context 
)

Definition at line 1293 of file logging.c.

Variable Documentation

◆ pcmk__config_error_context

void* pcmk__config_error_context

Definition at line 56 of file logging.c.

◆ pcmk__config_warning_context

void* pcmk__config_warning_context

Definition at line 57 of file logging.c.

◆ pcmk__config_warning_handler

pcmk__config_warning_func pcmk__config_warning_handler

Definition at line 55 of file logging.c.