pacemaker  3.0.0-d8340737c4
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__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_record_pending = (1 << 1), pcmk__wo_require_all = (1 << 4), pcmk__wo_order_score = (1 << 5),
  pcmk__wo_group_order = (1 << 11), pcmk__wo_group_coloc = (1 << 12), pcmk__wo_set_ordering = (1 << 15), pcmk__wo_rdisc_enabled = (1 << 16),
  pcmk__wo_op_attr_expr = (1 << 19), pcmk__wo_clone_master_max = (1 << 23), pcmk__wo_clone_master_node_max = (1 << 24), 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
 
bool pcmk__config_has_error
 
bool pcmk__config_has_warning
 

Macro Definition Documentation

◆ pcmk__config_err

#define pcmk__config_err (   fmt...)
Value:
do { \
pcmk__config_has_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:59
void(*) typedef void(*) pcmk__config_error_fun pcmk__config_error_handler)

Definition at line 95 of file logging_internal.h.

◆ pcmk__config_warn

#define pcmk__config_warn (   fmt...)
Value:
do { \
pcmk__config_has_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:58
void * pcmk__config_warning_context
Definition: logging.c:60

Definition at line 110 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:694

Definition at line 132 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:694
#define LOG_STDOUT
Definition: logging.h:43

Definition at line 157 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:694
#define LOG_STDOUT
Definition: logging.h:43

Definition at line 188 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:80

Definition at line 50 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 65 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 67 of file logging_internal.h.

Enumeration Type Documentation

◆ pcmk__warnings

Enumerator
pcmk__wo_blind 
pcmk__wo_record_pending 
pcmk__wo_require_all 
pcmk__wo_order_score 
pcmk__wo_group_order 
pcmk__wo_group_coloc 
pcmk__wo_set_ordering 
pcmk__wo_rdisc_enabled 
pcmk__wo_op_attr_expr 
pcmk__wo_clone_master_max 
pcmk__wo_clone_master_node_max 
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 331 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 415 of file logging.c.

◆ pcmk__cli_init_logging()

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

Definition at line 1160 of file logging.c.

◆ pcmk__free_common_logger()

void pcmk__free_common_logger ( void  )

Definition at line 1276 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 1223 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 1254 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 1285 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 1291 of file logging.c.

Variable Documentation

◆ pcmk__config_error_context

void* pcmk__config_error_context

Definition at line 59 of file logging.c.

◆ pcmk__config_has_error

bool pcmk__config_has_error

Definition at line 42 of file utils.c.

◆ pcmk__config_has_warning

bool pcmk__config_has_warning

Definition at line 43 of file utils.c.

◆ pcmk__config_warning_context

void* pcmk__config_warning_context

Definition at line 60 of file logging.c.

◆ pcmk__config_warning_handler

pcmk__config_warning_func pcmk__config_warning_handler

Definition at line 58 of file logging.c.